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

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


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


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.