I want to copy all my git repos from my old machine to my new machine (both Ubuntu). I will keep using both machines... I am doing this primarily out of laziness (well: there are for some local branches at the moment, and convenient stashes at hand, also the fact that I have multiple remotes connected, ... transfer of all of that is a bit tedious...),

...but (with some pains) yes, I could just well freshly clone from the various upstream repositories...

Question: Is this harmful in some way?

(Of course the repo states should be binary identical, whether I copy files or go for git clone. But I could imagine, git puts some kind of unique (g)uuid into the .git folder upon first clone or so, to distinguish machines or such... but just a guess. I simply don't know the inner workings...)


update: My worries are primarily around uuids or similar, non-uniqueness of then two local git 'repos' ("clients") connecting towards one remote repo ("master/server").

If you know about this being ok or not-ok, I need actual sources for that knowledge (beyond „I believe“ or „It is“).

That being said, I think I found sort of a duplicate of my question on Superuser.

  • 1
    There is no such unique identifier. In fact, git was designed specifically to not have the problem you are worried about. You may wish to read the Git Internals chapter of the Pro Git book. – Michael Hampton Oct 21 at 16:44

There is nothing wrong with repository move from one machine to another.

Git will update its internal configurations (if needed) on first run into the repo.

Maybe you can ask yourself why you need to move a repository like a normal folder, if your codebase needs things that are not included in a clean clone from remote then you're probably doing something wrong.

If you concerns are about project configuration files consider that probably on your new machine you'll have to recreate databases or change path or similar so there's no point in keeping old configurations for your project, start fresh and go clean.

  • As said, there's convenient stashes, multiple remotes connected, etc, etc... it's not about clean-ness of the repo. And things stretch a bit beyond a simple git clone. Clarified above. – Frank Nocke Oct 21 at 16:31

No harm. I recommend using rsync, but tar or cp will do just as well.

  • The file transfer is not my concern. It's more about 'having a duplicated git “client” of sorts'... – Frank Nocke Oct 21 at 16:30
  • rsync just makes it easier to not leave any file or permissions behind – ptman Oct 21 at 17:04

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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