本文介绍了Git无法正确推送Github gh页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行git push时,它说最新",但是当我执行git branch -vv时,它说:

when I git push, it says "everything up to date", but when I do git branch -vv, it says this:

MacBook-Pro:gitpracticing c$ git branch -vv
gh-pages 19f1cfc made after dinner
* ghpages  4aacdb1 [origin/gh-pages: ahead 11] yea
master   4aacdb1 [origin/gh-pages: ahead 11] yea
MacBook-Pro:gitpracticing corey$ 

即使我执行git push,origin/gh-pages分支仍然领先11.如何解决此问题?因此,我有3个分支:"gh-pages","ghpages"和"master".我注意到当我在gh-pages分支上时,我只能推送到origin/gh-pages,而不能推送到origin/master.当我进入master分支时,我只能推送到origin/master,而不能推送到origin/gh-pages.为什么是这样?我该如何同时推动两者?

even though I do git push, the origin/gh-pages branch is still ahead by 11. How do I fix this? So I have 3 branches: "gh-pages", "ghpages", and "master". I notice that when I'm on the gh-pages branch, I can only push to origin/gh-pages, and not origin/master. When I'm on the master branch, I can only push to origin/master, and not origin/gh-pages. Why is this? How can I push to both?

推荐答案

发生这种情况是因为您将ghpages设置为与原点/ghpages相匹配.但是,您可以使用命令中的另一个参数指定将接收提交的远程分支

That happens because you setted up ghpages to match origin/ghpages. You can, however, specify the remote branch that will receive your commits using one more parameter in the command

git push origin ghpages:origin/master

有关git push文档的更多信息,请此处PS:搜索"git push mothership master:satellite/master dev:satellite/dev"以获取我给您的解决方案的示例.

More on git push docs, herePS: search for "git push mothership master:satellite/master dev:satellite/dev" for an example of the sollution I gave you.

这篇关于Git无法正确推送Github gh页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 05:43