Git migration from one server to other keeping Git mirror intact

87 views Asked by At

I have a Git repository on remote server-R. There is a Git mirror between server-R and server-C. There are 10 other server which can clone code from Git master repository Server-R.

Server-R will scrapped soon and I need to move entire Git master repo from server-R to a new server-X. I have very limited knowledge of Git. What do I need to do to migrate the Git master repo from server-R to server-X keeping all the history checkin, Git mirror intact and all 10 server must be able to push and pull from new server-X git.

1

There are 1 answers

2
halfer On

It sounds like you have a number of Git repositories, all the same, and none of them are bare repos. When you do a git clone operation, you are copying the whole thing, and this is sufficient.

So, do a clone on the new primary server X, and then replace all of the remote references on all machines from R to X. You can see what remotes you have on any local repo by using:

git remote -v

To reset a remote, assuming you're using the default name of origin:

git remote set-url origin <new-url>

I would suggest that once you have reset all the URLs on all satellite repos, you push a dummy commit to the main server, and then pull from all others, to ensure they are pointing in the right direction.