Mon, 17 Nov 2008

Handling a remote rename/move with Git

I recently had to rename a repo on my Github account. Github has made this very easy but it's just one side of the issue. Obviously you must also update any references to this remote in other clones, otherwise pushes, fetches etc won't work anymore.

You can do this in two ways:

  • open .git/config and modify the url for the remote manually
  • git remote rm origin && git remote add origin git@github.com:$user/$project.git

That's it! All will work fine again.

Comments

Very interesting article. Thanks

it works ! thanks dude

Keep up the good work, and post more articles like the one you have posted above.

I know that this post is a bit aged but in case someone does use it as a reference I's like to add a quicker way to change the URL:

git remote set-url $new_url


Name:


E-mail:


URL:


Comment:


What is the first name of the guy blogging here?


This comment form is pretty crude. Make sure mandatory fields are entered correctly.
Basic html tags (a,i,b, etc) are allowed, others are sanitized