如何解决"git pull,致命:无法访问'https://github.com ... \':来自服务器的空回复"

Mer*_*lin 48 git github

当我使用Git命令"git pull"来更新我的存储库时,它失败了,如下所示:致命:无法访问'...':从服务器清空回复.

我尝试使用GitHub应用程序,但提醒:

Cloning into 'renren_mobile'...
warning: templates not found /Applications/GitHub.app/Contents/Resources/git/templates
2014-11-23 13:58:57.975 GitHub for Mac Login[659:11891] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Username for 'https://github.com': "
)
2014-11-23 13:58:58.032 GitHub for Mac Login[660:11915] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Password for '': "
)
fatal: unable to access '...': Empty reply from server
 (128)
Run Code Online (Sandbox Code Playgroud)

小智 31

我解决了这个问题.我认为这可能是因为https,但我不太确定.您可以将远程URL从HTTPS切换到SSH.

1.请参阅此链接了解详情:https://help.github.com/articles/changing-a-remote-s-url/

我还必须配置ssh密钥.

2.关注此:https://help.github.com/articles/generating-ssh-keys/

我遇到这个问题是因为我更换了我的mac,但是我做了数据传输,我认为这可能是因为关键原因.

  • 我正在添加关于此的评论,因为它首先出现在谷歌中,我想在此处扩展答案.我收到错误:推送失败:失败错误:致命:无法访问'https://github.com/username/repo.git/':来自服务器的空回复.对于我以及这个答案,本文来自github帮助:https://help.github.com/articles/changing-a-remote-s-url/#switching-remote-urls-from-https-to-ssh.我在OSX优胜美地 (4认同)

Gan*_*zy' 22

我一直陷入这个问题,直到我注意到我没有登录我的VPN.

说明:

1)如果您已为VPN配置代理,则需要登录VPN才能使用代理.

2)在VPN外部使用unset命令:

git config --global --unset http.proxy

并记住在VPN内设置代理.

希望这个评论可以节省3个小时的时间,我毫无意义地试图阅读变通方法

  • 感谢您提到 VPN!那是我的问题。我禁用了 VPN(私人互联网访问),一切正常。 (2认同)

Mar*_*rco 18

在Windows上:

转到Win - >控制面板 - >凭据管理器 - > Windows凭据

搜索github地址并将其删除.

在此输入图像描述

然后尝试执行:

git push -u origin master
Run Code Online (Sandbox Code Playgroud)

Windows将再次询问您的git凭据,放置正确的凭据,就是这样.


小智 12

Try, this

git config --global --unset http.proxy

git config --global --unset https.proxy

  • 取消设置 https.proxy 对我有用。谢谢 (2认同)

izi*_*tti 11

我尝试了一些这里列出的技巧,没有任何运气.看起来我的终端模拟器(iTerm2)或会话缓存了一些东西.当我从一个新的终端选项卡运行命令时,问题就消失了.

  • 这种解决方案是纯金 (2认同)
  • 我在 Windows 10 上使用 git bash 遇到了同样的问题,打开一个新的 git bash 窗口解决了这个问题。谢谢你! (2认同)

Nat*_*hat 5

如果取消设置使用

git config --global --unset-all https.proxy
Run Code Online (Sandbox Code Playgroud)

不适合你。

然后检查是否设置了环境变量http_proxyhttps_proxy。使用此命令检查: -

env | grep -i proxy
Run Code Online (Sandbox Code Playgroud)

如果此变量设置为 something ,那么您可以使用以下方法取消设置:-

   https_proxy=""
Run Code Online (Sandbox Code Playgroud)


ayo*_*bra 5

错误可能是,计算机保存了 git 用户名和密码,因此如果您切换到其他帐户,则会出现 403 错误。下面是解决方案

在 Windows 中

你可以在这里找到钥匙:

控制面板 > 用户帐户 > 凭据管理器 > Windows 凭据 > 通用凭据

接下来,删除 Github 密钥。

在苹果机上

在 Finder 中,搜索“钥匙串访问”应用 > 在“钥匙串访问”中,搜索 github.com > 查找 github.com 的“互联网密码”条目 > 相应地编辑或删除该条目。