21

The same question exists for mercurial, and I'm wondering how this applies to git? In particular, I'm interested in cases where there are two local repos, and copying between servers using rsync or such.

Also, if the original repo is itself cloned from, say gitorious, and I copy it, then gitorious will still exist as a remote (tracked by the master branch) in the copy, right? Does this happen if the copy is cloned instead?

Community
  • 1
  • 1
naught101
  • 18,687
  • 19
  • 90
  • 138
  • Um, the same exists for git too - possible duplicate of [git clone vs copy paste, what's the difference?](http://stackoverflow.com/questions/7303765/git-clone-vs-copy-paste-whats-the-difference) – manojlds Mar 15 '12 at 00:51
  • Yes, looks like it. I did search first, but didn't find that one. – naught101 Mar 19 '12 at 01:08

2 Answers2

34

Cloning a repository gives you a copy of that repository and configures the original repository as a remote.

Copying a repository just gives you a copy of that repository. (Though you can of course just add the remote definition afterwards via git remote add.)


Copying a repository copies its .git/config file, and thus its remotes. Cloning a repository does not copy the config file, and thus the remotes are not shared. (The repository that was cloned from is set as the origin remote in the resulting clone.)

Amber
  • 507,862
  • 82
  • 626
  • 550
1

I would also like to note that it's possible there will be a difference in CRC results between cloning and downloading from BitBucket. My work requires file integrity checks and we noticed that cloning the repository and running a CRC check on multiple files produced a different CRC result than the same files downloaded from the repository. After diffing the files there is no physical difference in the human readable text but the size of the file in bytes is different.

CodySig
  • 174
  • 1
  • 4
  • 15