Problem background:
The local warehouse is associated with multiple remote warehouses:
Now associate the local branch pagesServe with the coding-pages branch of the remote library coding:
When switching to pagesServe branch, execute git pull:
git automatically pulls the code from the remote library specified by coding.
Now modify the local code and execute git push:
without success. With the same configuration, git pull can run normally, but git push cannot, is it strange?
Follow the above error message and push again:
The remote library coding is specified here, and the execution of the local branch is HEAD and the remote branch is coding-pages to succeed. But why doesn't git pull need these? Besides, I have set up the association between pagesServe and the coding-pages branch of the coding remote library.
Let’s take a look at the master branch:
The remote library and remote branch association are also set up. After testing: git pull and git The push command can all run normally without any extra parameters that specify the remote library and branch:
can all run normally. , the only difference from the pagesServe branch is The master and the remote branch master have the same name. Is it because pagesServe and the remote branch have different names? Even if the association is configured, git forces us to specify the remote library and remote branch during the push operation?
習慣沉默2017-05-02 09:36:32
Unless you change your push.default
settings, I believe it won’t work:
git config push.default upstream
The default configuration should be to find the remote branch with the same name, so the error you mentioned will appear.
Someone has asked a similar question to you before: How can I push a local Git branch to a remote with a different name easily?
PHPz2017-05-02 09:36:32
Please enter it completely when submitting for the first timegit push origin 分支名