How to restore a Git remote after removing origin

By

Restore origin after removing a Git remote, reconnect your local repository to GitHub, and find the full git remote add lesson.

~~~

I had removed origin from a Git repository with git remote rm origin. To reconnect the same local repository to GitHub, I needed to put that remote back.

If you are setting up a remote for the first time, the course lesson on git remote add explains the command and remote names.

I restored the remote with:

git remote add origin git@github.com:flaviocopes/myrepo.git

Change flaviocopes/myrepo to your GitHub URL.

Done!

Tagged: Git · All topics

Want me to talk about your product? You can sponsor this site.

~~~

Related posts about git: