如何在git中设置默认遥控器? [英] How to set default remote in git?
问题描述
我的git仓库中有多个遥控器.如果我执行 git pull
,那么它将要求我一位同事的密码.
I have multiple remotes in my git repository. If I execute git pull
, then it asks for the password of one of my colleagues.
如何将遥控器更改为 black
?
推荐答案
没有默认的远程服务器,每个分支都可以从远程存储库中跟踪特定的分支.
There is no default remote, each branch can track a specific branch from a remote repo.
如果您使用 git checkout -b< branch-name>
创建了分支,其中< branch-name>
是远程分支的名称,则新分支跟踪该分支(从任何远程托管它的分支).
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).
如果您在本地创建分支,则使用 git push --set-upstream< remote-name>< branch-name>
,然后本地分支< branch-name>
跟踪远程分支< remote-name>/< branch-name>
.
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>
.
您始终可以使用 gitbranch --set-upstream-to
更改当前分支或
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.
这篇关于如何在git中设置默认遥控器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!