Git Clone
Whenever we create a git repository, by default it is created on the cloud but to do some changes or to add new files or new code we first need to clone a repository to our local system. By cloning in general means creating an exact version of something.
To clone the repository on your local system follow the below steps:-
- Go to your github account and look for the repository that you want to clone.
- Click on the repository name and copy the clone link
- Open your terminal and paste this link with git clone in the prefix
git clone (repo-link)
- Now do ls you will see a directory created on your system with the name of your repository, now you have cloned your repository to your local system.
- Now go to the local repository named as demo-repo/ using cd command.
$ cd demo-repo/
Now let us add some files in our repository and add a simple hello-world java program, go to the local repository and create a file name hello-world.java
In the above example we have created a file named hello-world.java using vim editor
To create it using vim, execute .
vim hello-world.java
Press i for inserting data and paste below code.
Class salesforcedrillers { public static void main(String args[]) { System.out.println("HELLO WORLD"); } }
For exiting from vim press : and then press wq which means write quit