Almost always directories called project.git
are used for bare repositories, so if you are using it for or to contain a non-bare repository you will probably cause some confusion.
Typically for a clone, you want to go into the directory in which you want to create the cloned repository and do:
git clone url://to/project.git
git will create the directory for the project
repository for you, you don't have to create it yourself. The name chosen by git is the last element of the url path without a .git
or a /.git
, if found.
git will fetch all remote branches and create you a local branch based on the HEAD
(default branch) of the remote repository. This is often called master
.
After making the clone you can create local branches based of any other remote branches if you wish using the git branch
command.
e.g. create a local branch based on the remote repositories other
branch.
git branch other origin/other
If you want git to create the project in a differently named repository directory you can supply this as an extra parameter to git clone.
e.g.
git clone url://to/project.git project-clone-2
Again, I recommend that you avoid directories ending with .git
unless you are intentionally creating a bare
clone.
git clone --bare url://to/project.git alt-project.git