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

Tip: For information on the difference between HTTPS and SSH URLs, see "Which remote URL should I use?"

The git remote set-url command takes two arguments:

  • An existing remote name, for example, origin
  • A new URL for the remote, for example:
    • https://github.com/USERNAME/REPOSITORY_2.git if you're updating to use HTTPS
    • git@github.com:USER/REPOSITORY_2.git if you're updating to use SSH