Windows 上的 Github“无法发布此分支”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13894387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Github "Failed to publish this branch" error on windows
提问by user1706538
I'm new to git, and I just downloaded it yesterday. As a test for my first online (not local) repo, I committed a useless text file and then hit publish. After a short while, I got this very non-descriptive error:
我是 git 新手,昨天刚下载。作为我第一个在线(非本地)存储库的测试,我提交了一个无用的文本文件,然后点击发布。过了一会儿,我得到了这个非常非描述性的错误:
So I know that I can't publish to this branch. There's only one and it's the master branch. Does anyone have any further information on what might be causing this error?
所以我知道我不能发布到这个分支。只有一个,它是主分支。有没有人对可能导致此错误的原因有任何进一步的信息?
As a side note, my partner has successfully uploaded files to the same repo, but I haven't gotten any sort of indication that this has happened. Does this mean I'm not connected to the repo properly in some way? I was the one who set it up!
作为旁注,我的合作伙伴已成功将文件上传到同一个存储库,但我没有得到任何迹象表明发生了这种情况。这是否意味着我没有以某种方式正确连接到 repo?我是设置它的人!
采纳答案by Mr_Green
In Windows, right click on your repository
--> click on open a shell here
在 Windows 中,右键单击您的repository
--> 单击open a shell here
You will see a command prompt.
您将看到一个命令提示符。
type git push
in it. (been aware after seeing SimonBoudrias comment)
输入git push
它。(看到 SimonBoudrias 评论后才知道)
The command prompt will suggest you to type some other command or shows an error.
命令提示符会建议您输入一些其他命令或显示错误。
If the command prompt suggest you to type something else, then type that. It will work.
If the command prompt shows error then please post the detailed error here.
如果命令提示符建议您输入其他内容,请输入该内容。它会起作用。
如果命令提示符显示错误,请在此处发布详细的错误信息。
Info: You might want to check this app
信息:您可能想查看此应用
回答by Nallebeorn
Open a shell
in your repository. Then type
shell
在您的存储库中打开一个。然后输入
git push --set-upstream origin master --force
This will upload your local repo to the server no matter what, overwriting
if necessary. This should only be done if you're sure nobody else is publishing to your repoat the moment.
overwriting
如有必要,无论如何这都会将您的本地存储库上传到服务器。这个如果你确定没有其他人发布到您的回购只应做的时刻。
回答by Has AlTaiar
I had the same issue as mentioned here, but none of the solutions mentioned above helped. Then I found this answerwhich talks about Proxy settings
, which is exactly why GitHub was failing to commit on my machine. Hope this helps somebody else
我遇到了与此处提到的相同的问题,但上面提到的解决方案都没有帮助。然后我找到了这个关于 的答案Proxy settings
,这正是 GitHub 未能在我的机器上提交的原因。希望这对其他人有帮助
To set up your Proxy Settings, you just need to use this command:
要设置代理设置,您只需要使用以下命令:
git config --global http.proxy http[s]://userName:password@proxyaddress:port
git config --global http.proxy http[s]://userName:password@proxyaddress:port
回答by Jose Luis Blanco
Another possibility is a temporary unavailability of GitHub servers.
另一种可能性是GitHub 服务器暂时不可用。
I'm just having the same problem and confirmed that it's a server issue: https://status.github.com/
我只是遇到了同样的问题并确认这是服务器问题:https: //status.github.com/
Sample screenshot:
示例截图:
回答by Dennis ?hlin
To fix it, open a command prompt in the repo. For example by pressing the cog in the top right in the repo view and selecting "open a shell here".
要修复它,请在 repo 中打开命令提示符。例如,按下 repo 视图右上角的齿轮并选择“在此处打开外壳”。
In the command prompt, type
git push --set-upstream origin master
Either this will work, or it will say
! [rejected] master -> master (fetch first)
If this happens, type
git pull origin master
(add --rebase if you like)
在命令提示符下,键入
git push --set-upstream origin master
要么这会起作用,要么它会说
! [rejected] master -> master (fetch first)
如果发生这种情况,请键入
git pull origin master
(如果您愿意,请添加 --rebase)
In GitHub the Publish-button might still be visible instead of the sync button. If this is the case, simply restart GitHub.
在 GitHub 中,发布按钮可能仍然可见,而不是同步按钮。如果是这种情况,只需重新启动 GitHub。
What this does is resetting the default remote branch for your local branch to master.
这样做是将本地分支的默认远程分支重置为 master。
回答by andylei
Maybe you just forget type something to the Description area when you commit your files. Someone like me only type the summery.So make sure you have fill in the Summary and Descriptionwhen you commmit.
也许您只是在提交文件时忘记在“描述”区域输入一些内容。像我这样的人只输入summery。所以确保你在提交时填写了摘要和描述。
Just type something to the Description textarea when commiting. Then i published successfully.
提交时只需在描述文本区域输入一些内容。然后我发布成功。
what i do?
1 Go to the folder of your repository in Windows Explorer
2 delete the file your want to publish. and recreat it.
3 Open GitHub For Windows and click on your Repository .then you will find Uncommitted changes on left side.
4 type your Summary
5 type your Description.(the most important step !!!)
6 commit to master
7 Hit Publish and You should be successful.
我所做的?1 转到您在 Windows 资源管理器中存储库的文件夹 2 删除您要发布的文件。并重新创建它。3 打开 GitHub For Windows 并单击您的存储库。然后您会在左侧找到未提交的更改。
4 输入您的摘要 5 输入您的描述。(最重要的一步!!!) 6 提交掌握 7 点击发布,您应该会成功。
This is my first answer. so i have no 10 reputation to post an image......hope help you.
这是我的第一个答案。所以我没有 10 声望来张贴图片......希望能帮助你。
回答by Ivy Growing
I had this error since I forgot to add remote repository link in the GitHub desktop. Once added the correct repo link, everything worked.
我有这个错误,因为我忘记在 GitHub 桌面中添加远程存储库链接。添加正确的回购链接后,一切正常。
回答by VladimirS
Try to commit your changes before publishing. It helps me to solve same problem.
在发布之前尝试提交您的更改。它帮助我解决同样的问题。
回答by Robin Raju
I too had the same problem while publishing my GitHub page. I solved it in the following way.
我在发布 GitHub 页面时也遇到了同样的问题。我通过以下方式解决了它。
$git push
I got the error message here. Then I made a pull request
我在这里收到错误消息。然后我提出了一个拉取请求
$git pull
After this I made the push again
在此之后,我再次推动
$git push
Here I got the solution
在这里我得到了解决方案
Note:I use GitHub for windows,And finally published the page using it
注:我在windows上使用GitHub,最后用它发布了页面
回答by PapaHotelPapa
I was getting that error because I hadn't properly configured my name and email. On the page where you do that (in the native app, at least), you'll see that the page opens with your name and email already filled in but that doesn't mean that they're saved as settings. In order to save them, you have to press the check mark in the bottom left corner of that screen.
我收到该错误是因为我没有正确配置我的姓名和电子邮件。在您执行此操作的页面上(至少在本机应用程序中),您会看到该页面打开时已填写您的姓名和电子邮件,但这并不意味着它们已保存为设置。为了保存它们,您必须按该屏幕左下角的复选标记。