这条消息是什么意思?不止一个分支.<name> .remote

use*_*638 19 git git-branch

在输出中git remote show origin,我看到这条消息:

warning: more than one branch.main_int.remote
Run Code Online (Sandbox Code Playgroud)

一个更典型的例子是:

warning: more than one branch.master.remote
Run Code Online (Sandbox Code Playgroud)

这是什么意思?这是不好的,如果它不好,我该如何解决呢?

Ric*_*sen 28

您的配置文件remote = ...[branch "master"](或[branch "main_int"])部分中有多个设置.要查看此内容,请运行:

git config --get-all branch.master.remote
Run Code Online (Sandbox Code Playgroud)

机会都在.git/config文件中.删除其中一行.

如果你只看到一个remote = ...在你行.git/config的文件,检查你的~/.gitconfig,~/.config/git/config/etc/gitconfig文件.(存储库的有效配置是所有这些文件的串联.)

该配置设置存储分支的上游资源库,当你键入所使用的名称git pushgit fetch.分支只能有一个上游分支(例如,master可以按照origin/master但它不能跟随some_other_remote/master).

  • 请注意,如果您使用[`git config --global branch.master.remote origin`]全局设置它,那么您的存储库配置中的*one*`remote = ...`设置可能会很多(http:/ /stackoverflow.com/questions/658885/how-do-you-get-git-to-always-pull-from-a-specific-branch). (4认同)