This week we moved our git repositories to a new platform used in the company. This operation is simpler than a move from say SVN to git. Still here are some points not to overlook.
It is always a good idea to take a closer look at the documentation of the commands in this post. For example the docs on git clone.
Copy
The actual copy is straight forward some commands:
git clone --mirror <source location>
cd <source location>.git
git remote add new-origin <target location>
git push -u new-origin --all
git push new-origin --tags
Notes
But copying is not all you have to do to carry on smoothly. You should take in account the following points.
- Pull requests are not moved
- Branch permissions and default branch settings have to be set on the new repo
- Build jobs have to point to the new repo (and the user of the new repo must have enough rights)
- Other users of the repo have to set the new repo. Use the following command:
git remote set-url origin new.git.url/here
Hopefully you can now move repositories without pain. Happy moving!