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

Advertisement
Categories: Tags: , ,

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.