如何解决“git pull,fatal: 无法访问‘https://github.com...\’:来自服务器的空回复”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27087483/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:41:25  来源:igfitidea点击:

How to resolve "git pull,fatal: unable to access 'https://github.com...\': Empty reply from server"

gitgithub

提问by Merlin

It's failed when I used Git command "git pull" to update my repository, messages as below: fatal: unable to access '...': Empty reply from server.

当我使用 Git 命令“git pull”更新我的存储库时它失败了,消息如下:致命:无法访问“...”:来自服务器的空回复。

And the I tried to use the GitHub App, but alert this:

我尝试使用 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)

采纳答案by Hao Kang

I resolved this problem. I think it happened maybe because of https but I am not very sure. You can Switch remote URLs from HTTPS to SSH.

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

1.Pls refer to this link for details:https://help.github.com/articles/changing-a-remote-s-url/

1.详情请参考此链接:https://help.github.com/articles/changed-a-remote-s-url/

Also I had to config the ssh key.

我还必须配置 ssh 密钥。

2.Follow this:https://help.github.com/articles/generating-ssh-keys/

2.按照这个:https://help.github.com/articles/generating-ssh-keys/

I came across this problem because I replaced my mac, but I do the transfer of data,I think it is probably because the key reasons.

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

回答by Ganesh Kamath - 'Code Frenzy'

I was stuck in this problem until i noticed that i was not logged into my VPN.

我一直被这个问题困扰,直到我注意到我没有登录到我的 VPN。

Explanation:

解释:

1) If you have configured your proxy for a VPN, you need to login to your VPN to use the proxy.

1) 如果您为 VPN 配置了代理,则需要登录到您的 VPN 才能使用代理。

2) to use it outside the VPN use the unset command:

2) 要在 VPN 之外使用它,请使用 unset 命令:

git config --global --unset http.proxy

git config --global --unset http.proxy

and remember to set the proxy when within the VPN.

并记住在 VPN 内设置代理。

Hope this comment saves someone the 3 hours I was pointlessly trying to read workarounds

希望此评论可以节省我无意义地尝试阅读解决方法的 3 个小时

回答by Marco

On Windows:

在 Windows 上:

Go to Win -> Control Panel -> Credential Manager -> Windows Credentials

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

Search for github address and remove it.

搜索github地址并删除。

enter image description here

在此处输入图片说明

Then try to execute:

然后尝试执行:

git push -u origin master

Windows will ask for your git credentials again, put the right ones and that's it.

Windows 将再次询问您的 git 凭据,输入正确的凭据,仅此而已。

回答by izilotti

I tried a few of the tricks listed here without any luck. Looks like something was getting cached by my terminal emulator (iTerm2) or session. The issue went away when I ran the command from a fresh terminal tab.

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

回答by Natesh bhat

If unsettingusing

如果取消设置使用

`git config --global --unset-all https.proxy`

doesn't work for you .

不适合你。

Then check if the environment variable http_proxyand https_proxyare set . Check using this command : -

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

`env | grep -i proxy`

If this variable is set to something , then you can just unset it using :-

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

`https_proxy=""`

回答by ddsultan

I solved such a problem by replacing https part of my remote origin with http. It is also a workaround. I think it may help someone in the future.

我通过用 http 替换远程源的 https 部分解决了这个问题。这也是一种解决方法。我认为这可能会在将来对某人有所帮助。

回答by Niki Dimitrov

I had tried most of the answers here but didn't manage to resolve the issue (on Windows 10).

我在这里尝试了大部分答案,但未能解决问题(在 Windows 10 上)。

What resolved the problem was simply to upgrade version from git version 2.8.1.windows.1to the latest version git version 2.10.1.windows.1

解决问题的只是将版本升级git version 2.8.1.windows.1到最新版本git version 2.10.1.windows.1

回答by Ratnesh Shukla

Try, this

尝试这个

git config --global --unset http.proxy

git config --global --unset http.proxy

git config --global --unset https.proxy

git config --global --unset https.proxy

回答by Sagar

You can try for following solutions step by step one of them should work for you.

您可以逐步尝试以下解决方案,其中之一应该适合您。

I have tried all three steps but STEP 4worked for me. Because I was using two different git accounts

我已经尝试了所有三个步骤,但STEP 4对我有用。因为我使用了两个不同的 git 帐户

STEP 1:

第1步:

STEP 2

第2步

  • Check your current branch git branchif you are not on branch git checkout branch_name.

  • To create new branch use git checkout -b "new branch name"to switch on new branch use above command

  • git branch如果您不在 branch ,请检查您当前的 分支git checkout branch_name

  • 要创建新分支git checkout -b "new branch name",请使用以上命令打开新分支

STEP 3

第 3 步

  • In the special case that you are creating a new repository starting from an old repository that you used as a template (Don't do this if this is not your case). Completely erase the git files of the old repository so you can start a new one:

    rm -rf .gitand repeat STEP 1

  • 在特殊情况下,您要从用作模板的旧存储库开始创建新存储库(如果不是这种情况,请不要这样做)。完全擦除旧存储库的 git 文件,以便您可以开始一个新存储库:

    rm -rf .git并重复步骤 1

STEP 4

第四步

  • On windows, you can try putting write credentials or remove git credentials from the control panel by following way and repeat STEP 1

    Go to Win -> Control Panel -> Credential Manager -> Windows Credentials

  • 在 Windows 上,您可以尝试通过以下方式从控制面板中放置写入凭据或删除 git 凭据并重复步骤 1

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

enter image description here

在此处输入图片说明

回答by Alex Trn

I received the same error in pushing files to my private bitbucket repository. For some odd reasons, the request couldn't be sent and an empty reply was the result! I tried again with a proxy tunnel (you can use any other VPN applications) and it has been solved till now.

我在将文件推送到我的私人 bitbucket 存储库时收到了同样的错误。由于一些奇怪的原因,请求无法发送,结果是一个空的回复!我再次尝试使用代理隧道(您可以使用任何其他 VPN 应用程序),直到现在它已经解决了。