tags:

views:

63

answers:

3

My git folder looks like:

c:\mygits\project1.git\

So I went into that project1.git folder, and then did a clone.

For some reason (is this normal?), it created a master folder which I am forced to go into.

c:\mygits\project1.git\master\

if I just to to the project1.git folder, it says no repo is here.

+3  A: 

How did you clone it? It looks like you have done

git clone c:\... master

The last term creates a target directory.

ustun
I thought master was the name of the branch I wanted to clone.
mrblah
@mrblah: A clone will pull in ALL branches. All history and branches are stored locally in the .git directory.
gahooa
+2  A: 

Did you include an extra master parameter at the end when you cloned your repository? The parameter after the clone url is the local directory name.

git clone repository directory

directory is optional. It will default to the repository name if omitted.

Git clone documentation

HakonB
+5  A: 

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
Charles Bailey