有一个名为“my-remote”的远程分支,我之前已毫无问题地推送到该分支。截至今天,我无法推动并且出现不同的错误。
我得到的第一个错误是:
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration
hint: variable to 'current' or 'upstream' to push only the current branch.
我做了一些研究并运行了这个希望它能解决问题:
git config push.default tracking
运行后我再次运行推送:
git push https://github.com/someurl/mybranch.git
我收到以下错误:
pushing to remote 'https://github.com/someurl/mybranch.git', which is not the upstream of
your current branch 'my-remote', without telling me what to push
to update which remote branch.
我尝试过运行这个:
git push master:my-remote https://github.com/someurl/mybranch.git
但它告诉我:
fatal: remote part of refspec is not a valid name in https://github.com/someurl/mybranch.git
如果您想将 master 分支推送到 my-remote 远程分支上,正确的语法是:
git push https://github.com/someurl/mybranch.git master:my-remote
(第一个:远程存储库参考,refspec,来自git push手册页 http://git-scm.com/docs/git-push)
关于您的第一条错误消息,如果它确实没有告诉您合并,那么git pull --rebase
可能需要。
或者至少是:
git config --global push.default current
(如“配置 Git 仅推送当前分支 http://jimkubicek.com/blog/2012/08/16/git-push-current-branch/").
如果您在当地分行'my-remote
'(根据命令就是这种情况),您可以通过以下命令来确保设置了上游分支:
git push -u https://github.com/someurl/mybranch.git my-remote:my-remote
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)