• Dev
  • Git
  • Remote

Remote

Add Remote URL

git remote add <REMOTE_ALIAS> <REMOTE_URL>

A remote alias / name can hold / be used for multiple push remote URL, the first remote URL being set will be set as pull and push. The additionals will be set as push only. *cmiiw

Add Push Remote URL to Current Remote Alias

git remote set-url --add <REMOTE_ALIAS> <ADDITIONAL_REMOTE_URL>

Replace Current Remote URL

git remote set-url <REMOTE_ALIAS> <UPDATED_REMOTE_URL>
 
## if a remote alias have multiple remote url but only want to update one of it
git remote set-url <REMOTE_ALIAS> <UPDATED_REMOTE_URL> <REMOTE_URL_TO_BE_REPLACED>

Remove a Push Remote URL from Current Remote Alias

git remote set-url --delete <REMOTE_ALIAS> <REMOTE_URL_TO_BE_REMOVED>

Get Remote URL of a Remote Alias

git remote get-url <REMOTE_ALIAS>
 
## to get all
git remote get-url --all <REMOTE_ALIAS>