I'm pretty new to Git and was wondering if it's ok to copy a git repository with common UNIX commands (like cp or tar/untar), rather than through git clone.

I'm in the situation where I have a production (python virtual) environment that some code checked out in Git in it. I'm wondering if it's a bad idea from a Git perspective to copy down the whole environment using a tar or something. This approach would be convenient for making a quick copy of a codebase/environment, but wondering if I'll have trouble with Git.

My concern is that maybe git clone associates some unique id with the working copy that could cause conflicts if two working copies exist where one was filesystem-copied from the other.

Any advice is much appreciated. Thank you, Joe

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted

It is perfectly fine.

git stores all of its history, commits, etc. on site - this is a fundamental property of a DCVS.

Technically speaking, git can operate just fine with copied repositories running around everywhere, because the whole point of a DCVS is that it doesn't have to know what's going on outside of any given repository, and in fact doesn't unless you tell it.

The same principle applies here.

link|improve this answer
Thank you new123456, that's good to know. I guess I'm thinking in svn land. – Joe J Jul 26 '11 at 19:00
feedback

You should be able to copy the entire working directory to anywhere else on your system and have it continue to function as normal when using Git, Hg, or SVN. I can't comment on other SCMs.

link|improve this answer
Thank you Darth Android. Much appreciated. – Joe J Jul 26 '11 at 19:02
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.