Home > git > Change git origin

Change git origin

Scenario:
you checkout a remote github repo as read-only:

git clone git://github.com/yourusername/oneofyourrepo

After you work on the local working directory for a while you decide that you would want to be able to push the changes back to github.

The easiest way is to either:
1) run the follow command on the root of the working directory:

git config remote.origin.url git@github.com:yourusername/oneofyourrepo

2) edit .git/config, look for section [remote “origin”] and change the url to
git@github.com:yourusername/oneofyourrepo

If you have already added the ssh public key of the host that you are working on to github.com, you should now be able to push the changes.

Credit goes to: http://stackoverflow.com/questions/3011402/leaving-github-how-to-change-the-origin-of-a-git-repo

Advertisements
Categories: git
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: