git 从服务器推送空回复时出现 gits 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28364023/
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
gits error on push Empty reply from server
提问by codebased
I have been trying to push new changes to my existing repo, however, I am keep getting the following error:
我一直在尝试将新更改推送到我现有的存储库,但是,我不断收到以下错误:
-MacBook-Pro:spa $ git push origin master Username for XX Password for fatal: unable to access 'https://github.com/XXXX/': Empty reply from server
-MacBook-Pro:spa $ git push origin master 用户名 XX 密码致命:无法访问“ https://github.com/XXXX/”:来自服务器的空回复
I have even tried with the new repo but the result is same.
我什至尝试过新的回购,但结果是一样的。
回答by codebased
grr...
呃...
The problem got fixed after restarting my Mac computer.
重新启动 Mac 计算机后问题得到解决。
回答by Oleg Oleg
Maybe mine was another problem but the same output: "Empty reply from server". I resolved it by doing
也许我的是另一个问题,但输出相同:“来自服务器的空回复”。我通过做来解决它
git fetch origin --prune
git fetch origin --prune
After that, push was successful.
之后,推送成功。
回答by Wilmar PR
You can restart you computer, or else restart your local server.
您可以重新启动计算机,或者重新启动本地服务器。
回答by Fazeel Ahmed
I had a similar problem with Git. I figured it was a problem pertaining to Git Credentials managed by Windows.
我在 Git 上遇到了类似的问题。我认为这是与 Windows 管理的 Git 凭据有关的问题。
Here's what I tried step by step
这是我一步一步尝试的
- Restarting my computer
- Restarting my network device
- Deleting credentials from credential manager on windows' control panel
- Redefining Remote URL by using
git remote set-url
- 重新启动我的电脑
- 重新启动我的网络设备
- 从 Windows 控制面板上的凭据管理器中删除凭据
- 使用重新定义远程 URL
git远程设置-url
When I tried pushing after these steps, windows asked for new credentials. I entered my Github/whatever service's username and password and the push was successful.
当我尝试执行这些步骤时,Windows 要求提供新凭据。我输入了我的 Github/任何服务的用户名和密码,推送成功。
Here's what I think happened. When you don't add credentials manually, Windows stores the credentials in a temporary cache when you make a repository for the first time. Unfortunately this temporary cache is lost after some time, thus the credentials for logging onto your remote Git are lost. Adding them manually once should solve the problem for good.
这就是我认为发生的事情。如果您不手动添加凭据,Windows 会在您第一次创建存储库时将凭据存储在临时缓存中。不幸的是,这个临时缓存会在一段时间后丢失,因此用于登录远程 Git 的凭据也会丢失。手动添加一次应该可以很好地解决问题。
回答by Alon Lavian
Answered here: https://stackoverflow.com/a/27352176/4402501
在这里回答:https: //stackoverflow.com/a/27352176/4402501
In short:
简而言之:
- Add ssh-key to your github repository (instructions here).
- Switch your remote URL from HTTPS to SSH (instructions here).
- Push it like it's hot.
回答by Sam
It might seem shortsighted to mention this but for me, restarting my mac did the trick. I'm working in an office with a proxy and had the same issue and restarting was the only thing that worked for me.
提到这一点似乎短视,但对我来说,重新启动我的 mac 就成功了。我在一个有代理的办公室工作,遇到了同样的问题,重新启动是唯一对我有用的方法。