Reputation:
A while ago we setup a git repository for internal use on a local server. The server is not on a business line and thus has a non-static ip.
We want to move the git origin from the local server to a new remote server (this is our private dedicated server, not github or similar).
Can we just rsync the entire git directory over to the new server?
Upvotes: 4
Views: 1630
Reputation: 1328262
The safest way (which would not bring with it local config or hooks, which can be specific to the local environment, and have sensitive information you wouldn't always want to include in an archive) would be to use git bundle.
git bundle create /tmp/myrepo.bundle --all
See "How can I email someone a git repository?"
That creates only one file (easy to copy around), which you can clone or fetch from:
On the target server
git clone myrepo.bundle
cd myrepo
Upvotes: 2
Reputation: 165416
Git repositories have nothing linking them to their directory or server (unless you configured something specifically). You can move them like any other directory of files. A USB stick, scp, rsync, mv, zip, tar... whatever.
Upvotes: 1
Reputation: 14629
Though the simplest way would surely be to do a git clone
, yes, you can use rsync.
Upvotes: 4