Change the origin of a Git repository
Published ago
Updated ago
1 min read
More than once I have needed to change the origin of a repository, so to make my life easier I decided to make the annotation here.
The first thing you need is a new repository, let's say it is git@github.com:emeaguiar/mah-theme.git
Now, the thing is as simple as removing the old origin remote, adding the new one, and configuring it as master.
1# Remove old origin2~ git remote rm origin34# Add new origin56~ git remote add origin78# Configure it as master910~ git config master.remote origin11
Done! Now when you run git remote get-url origin --all
you will see the new repository.