What's the difference between cloning and copying a git repo?

依然范特西╮ 提交于 2019-12-03 11:31:13

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/9712234/whats-the-difference-between-cloning-and-copying-a-git-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!