Moving a git repo to a different remote

Copy a git repository from one remote to another with history

  1. Clone with mirror
git clone --mirror <url to ORI repo> temp-dir
  1. Remove the remote origin
git remote rm origin
  1. Add the new remote origin
git remote add origin <url to NEW repo>
  1. Push the repo to the new remote
# origin can be replaced with a name of your choice

git remote add origin <url to NEW repo>
git push -u origin main
Dalton

© 2025 Aria

GitHub