-
Notifications
You must be signed in to change notification settings - Fork 7
How To Change Git Remote Origin?
junwufan edited this page Aug 24, 2021
·
1 revision
The git remote set-url command changes an existing remote repository URL.
To add a new remote, use the git remote add
command on the terminal, in the directory your repository is stored at.
git remote add origin https://github.com/user/repo.git
In order to change the URL of a Git remote, you have to use the git remote set-url
command and specify the name of the remote as well as the new remote URL to be changed.
git remote set-url <remote_name> <remote_url>
In order to achieve that, you would use the set-url
command on the origin
remote and you would specify the new URL.
git remote set-url origin https://git-repo/new-repository.git
Congratulations, you successfully changed the URL of your Git remote!
List your existing remotes in order to get the name of the remote you want to change.
$ git remote -v