Friday, 11 May 2012

Git - Changing the url of the remote repository

When the git repository is created locally for the first time, the remote repository url will be recorded. To se it, open a terminal and type:

git remote -v

The result is something like:

origin (fetch)
origin (push)

To change it, type:

git remote set-url origin NewUrlForRemoteRepository

Note: Ater you have changed the url of the remote repository, the first time you do anything with the repository, it is possible you will see a warning message about a new key to trust. This is absolutely normal because you might have changed the server and the new server has a new key.

Note2: The url of the remote repository is saved inside the file .git/config of your repository. You might want to changed manually, but it is not encouraged by the author.

No comments:

Post a Comment