Creating a repository in Git

The first step in working with git is to create a new git repository.We can create a new git repository by either

  • copying an existing repository
  • initializing a new repository

Copying an existing repository

for copying an existing repository we use the git clone command.To clone an existing repository from an existing location we use the command as:
git clone “url of the repository”

for example to clone a repository at the location we use the following command
git clone

The above command will copy the existing repository from  “” to the local machine.The name of the new repository will be the same as the existing repository.
If we want to provide a different name for the cloned repository then we can pass the name of the repository as:
git clone NewRepository

Initialize a new repository

To initialize an existing directory as git repository we use:

git init

we execute the above command from within the directory which we want to initialize as git repository

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *