git remote set-url origin <url>
Changes the url of the `origin` remote repository.
This command is used to modify the URL from which a git repository was originally cloned (the origin
). This is useful when you want to switch to a different remote repository or change the access method (switch between SSH and HTTPS, for instance). The <url>
parameter is to be replaced by the new URL for the repository. The set-url
option updates the URL for the origin
. Other variations include git remote set-url --add
to add a new URL and git remote set-url --delete
to remove a URL.
Specific examples:
git remote set-url origin https://github.com/git/git