Git Remote Moved?

Posted on in programming

cover image for article

There are lots of reasons why your Git repository remotes might move. I recently dealt with a migration to GitHub. You can always just clone the repository again and go about your business, but I had several local branches I wanted to keep working on.

There's lots of ways to do this, but here's how I did it.

git checkout main
git remote remove origin && git remote add origin git@github.com:slaptijack/src.git
git branch --set-upstream-to origin/main

The first and last commands are just to make sure your local main branch is tracking the remote main.

git

Slaptijack's Koding Kraken