Skip to content

Instantly share code, notes, and snippets.

@mauricios
Last active December 28, 2017 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricios/31c1ced33b3cde47d1140b21bd3b91dc to your computer and use it in GitHub Desktop.
Save mauricios/31c1ced33b3cde47d1140b21bd3b91dc to your computer and use it in GitHub Desktop.
Migrate Git repo from one remote to another
#!/bin/bash
# Clone the old repo using the mirror option
git clone --mirror git@git.my-old-server.com:my-old-repo.git
# Enter the new clonned repo directory
cd my-old-repo.git
# Add the new remote repo
git remote add new_origin git@git.my-new-server.com:my-new-repo.git
# Push to the new repo using mirror option
git push new_origin --mirror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment