Search code examples
gitgit-branch

what does this message mean? more than one branch.<name>.remote


In the output from git remote show origin, I see this message:

warning: more than one branch.main_int.remote

A more canonical example would be:

warning: more than one branch.master.remote

What does this mean? Is it bad, and how do I fix it, if it is bad?


Solution

  • You have more than one remote = ... setting in the [branch "master"] (or [branch "main_int"]) section of your config file(s). To see this, run:

    git config --get-all branch.master.remote
    

    Chances are both lines are in the .git/config file. Delete one of the lines.

    If you only see one remote = ... line in your .git/config file, check your ~/.gitconfig, ~/.config/git/config, and /etc/gitconfig files. (The effective config for a repository is the concatenation of all of these files together.)

    That configuration setting stores the name of the branch's upstream repository, which is used when you type git push or git fetch. A branch can only have one upstream branch (e.g., master can follow origin/master but it can't also follow some_other_remote/master).