git remote set-url <name> <newurl> command changes existing remote repository URL.
For example, to switch from a github repository from HTTPS to SSH:
- Change the current working directory to local project.
- List existing remotes in order to get the name of the remote to change.
git remote -v
origin https://github.com/shark-oxi/RawSec.git (fetch)
origin https://github.com/shark-oxi/RawSec.git (push)- Change remote's URL from HTTPS to SSH with the
git remote set-urlcommand.
git remote set-url origin git@github.com:shark-oxi/RawSec.git- Verify that the remote URL has changed.
git remote -v
origin git@github.com:shark-oxi/RawSec.git (fetch)
origin git@github.com:shark-oxi/RawSec.git (push)