How to make sure developers use new git remote after repository migration

64 views Asked by At

Every answer about migrating git repo says:

git clone --mirror git@github/odlrepo.git
git push --mirror git@github/newrepo.git

But nobody says, what to do after...

How to force developers to use newrepo?

Solutions that I came with are:

  • git hook on oldrepo which will push changes to newrepo (but if developers keep pushing to both - it seems like its asking for troubles)
  • git hook which blocks commits and says "change remote, we are using now newrepo

But maybe there are some better solutions?

1

There are 1 answers

0
VonC On

Without having to manage hooks, you could:

  • protect your old repo branches in order to disable any push
  • empty the content of the master branch to leave only a README which clearly explain the situation, asking for developers to now clone from or push to the new repository.