11

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?

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 Answers2

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