How to change the remote url of a local repository


The git remote set-url command changes an existing remote repository URL.

Syntax:

git remote set-url <name> <newurl> <oldurl>

The git remote set-url command takes two arguments:

  • An existing remote name <name>. For example, origin (or upstream are two common choices).
  • The new url <newurl> followed by the old url <oldurl>.

Example:

git remote set-url origin https://github.com/username/new.git https://github.com/username/old.git


Leave a Reply

Your email address will not be published.