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:-

  1. Go to your github account and look for the repository that you want to clone.
  2. Click on the repository name and copy the clone link

    github account

  3. Open your terminal and paste this link with git clone in the prefix
    git clone (repo-link)
    

  4. 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.
  5. Now go to the local repository named as demo-repo/ using cd command.
  6. $ 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

local repository

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

Subscribe Now