Say I have a bare repository on my local machine at ./new-bare.git
.
What is the correct way to clone it to another location on my machine?
Asked
Active
Viewed 1.3k times
11

Omer Dagan
- 14,868
- 16
- 44
- 60
-
Possible duplicate of [git clone from another directory](http://stackoverflow.com/questions/21045061/git-clone-from-another-directory) – frlan Aug 16 '16 at 08:55
-
1@frlan Different question- I'm referring to cloning from bare repositories, as emphasized in the header – Omer Dagan Aug 16 '16 at 09:06
-
bare / non-bare should not make any difference – frlan Aug 16 '16 at 09:11
2 Answers
20
There is no difference in cloning from a not bare repository:
/tmp> mkdir foo
/tmp> git init --bare foo
Initialized empty Git repository in /tmp/foo/
/tmp> git clone /tmp/foo /tmp/baa
Cloning into '/tmp/baa'...
warning: You appear to have cloned an empty repository.
done.

frlan
- 6,950
- 3
- 31
- 72
-
I'm was a little confused with the use of `--local` but I guess your answer works for my simple case. 10X – Omer Dagan Aug 16 '16 at 09:17
8
git clone path_to_new-bare.git new_destination

Shravan40
- 8,922
- 6
- 28
- 48
-
It's worth mentioning that this appears to only work when the folder name ends with `.git` (as in the example). Apart from that, much nicer than the accepted answer, thanks :) – Daniel Veihelmann Mar 11 '21 at 11:38