SO 上有一个相关问题处理如何更改 push
命令的参数以避免出现此消息:
fatal: The upstream branch of your current branch does not match the name of your current branch
我对如何压制消息本身很感兴趣,无需更改我的本地/远程分支的名称或使用花哨的 push
命令。
假设我有一个本地分支跟踪一个不同名称的远程分支:
user@home:~ git branch -vv
branch-name abcd1234 [remote/origin/branch-name] last commit message
现在我希望能够通过简单地键入 git push
来推送我提交的更改。当我这样做时,我收到以下消息:
fatal: The upstream branch of your current branch does not match the name of your current branch. To push to the upstream branch on the remote, use git push origin HEAD:remote/origin/branch-name To push to the branch of the same name on the remote, use git push origin branch-name
即使名称不匹配,如何强制 git
自动推送到上游分支?我正在使用 git 1.9.1
最佳答案
较新的 Git(v 1.9 或更新版本)
git config --global push.default upstream
较旧的 Git
git config --global push.default tracking
Git 2.3 仍然接受 tracking
作为上游的同义词
只需执行一次,每当您“git push”时,它就会将您当前的分支推送到其配置的上游。
这也会在您的全局配置中设置它,它可能会被您的存储库配置中的不同设置 stash 。
关于git - 我如何压制 "fatal: The upstream branch of your current branch does not match the name of your current branch"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25964577/