I have multiple remotes in my git repository. If I execute git pull
, then it asks for the password of one of my colleagues.
How can I change the remote to black
?
There is no default remote, each branch can track a specific branch from a remote repo. If you have created the branch using git checkout -b <branch-name> where <branch-name> is the name of a remote branch then the new branch tracks that branch (from whatever remote hosts it).
In order to change the URL of a Git remote, you have to use the “git remote set-url” command and specify the name of the remote as well as the new remote URL to be changed. For example, let's say that you want to change the URL of your Git origin remote.
There is no default remote, each branch can track a specific branch from a remote repo.
If you have created the branch using git checkout -b <branch-name>
where <branch-name>
is the name of a remote branch then the new branch tracks that branch (from whatever remote hosts it).
If you created the branch locally then used git push --set-upstream <remote-name> <branch-name>
then the local branch <branch-name>
tracks the remote branch <remote-name>/<branch-name>
.
You can always use git branch --set-upstream-to
to change the remote branch that is tracked by the current branch or git branch --unset-upstream
to tell it to not track any remote branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With