What is the scope of git remote set-url command?

Viewed 123

What is the scope of git remote set-url command?

Is it applicable for present git repo only or is it universal for the computer (so applicable to all repos on this computer)?

1 Answers

git remote set-url is only for the current repository.

And only if said current repository already had a remote.
If you are adding a new remote, as opposed to modifying the URL of an existing remote, the command would be:

cd /path/to/local/repos
git remote add <newRemote> <url>
git remote add <newRemote> <url>|grep remote

You can list all configuration and their scopes with:

cd /path/to/local/repo
git config -l --show-origin --show-scope
git config -l --show-origin --show-scope|grep remote

The last command (with grep) would show only "local" scope for remote.

local   file:.git/config        remote.origin.url=...
Related