Why does git remote add create fetch refspec but not push refspec?

According to the documentation for git config, the following two elements are supported:

remote.<name>.fetch
    The default set of "refspec" for git-fetch(1). See git-fetch(1).

remote.<name>.push
    The default set of "refspec" for git-push(1). See git-push(1).

However, when I issue

git remote add <name> <url>

I see that only fetch refspec is added. Why is the “push” handled by the second class here? What is the reason?

+4
source share
1 answer

Although it seems that it can be better documented, it probably has something to do with it:

push.default

Defines the action to be taken git pushif refspec is not specified on the command line, refspec is not specified remotely, and no refspec option is implied by any of the options specified on the command line.

Possible values:

  • nothing - .
  • matching - . . .
  • tracking - .
  • current - .

push refspec push.default, , - , , push refspec. , , , - -, push refspec.

+1

Source: https://habr.com/ru/post/1548496/


All Articles