Changing GitHub project origin

You may need to change a GitHub origin definition in the client-side, some reasons to do this are:

  • the repo name changed;
  • you want to switch from HTTPS to SSH or vice-versa.

Imagine I want to change my authentication method from HTTPS to SSH, the HHTPS URL I want to replace is:

the SSH URL want to start using is:

Start by listing current origin:

$ git remote -v
origin (fetch)
origin (push)

Now remove the origin no longer in use:

$ git remote remove origin

Finally add the new SSH URL:

git remote add origin

Now check you successfully switched to SSH:

$ git remote -v
origin (fetch)
origin (push)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s