Migrate git repository to new server

Migrate git repository to new server

Clone the old repo

 git clone git@OLD_SERVER:GROUP/PROJECT.git

Look for the remote server in you repo

git remote -v
origin git@OLD_SERVER:GROUP/PROJECT.git (fetch)
origin git@OLD_SERVER:GROUP/PROJECT.git (push)

Remove the old server from list

git remote rm origin

Add new server and push the repo

git remote add origin git@NEW_SERVER:GROUP/PROJECT.git
git push -u origin master

If you like to copy the tags

git push origin --tags -f

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.