如何解决“ git pull,death: 无法访问‘网址0’: 来自服务器的空回复”

当我使用 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)
399517 次浏览

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.

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

Also I had to config the ssh key.

2.Follow this: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.

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.

I solved, replacing 'http..' git url with 'ssh..' simple open .git/config file and copy it there

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

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

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

    git config --global --unset http.proxy
    

And remember to set the proxy when within the VPN.

I had the same problem however, with a Jenkins installation. The response back from trying to clone was always:

stderr: fatal: unable to access 'https://my.gitlab.server/group/repo.git/': Empty reply from server

Unfortunately switching to http wasn't an option, so I needed the root cause. Turns out there was a http setting in the global config for the Jenkins user (likely added when we were running a self-signed cert on out gitlab instance). Taking look at the global config:

$ git config --global -l
http.sslverify=false

Removing this did the trick

$ git config --global --unset http.sslverify

(It also looks like this is a typo, with the correct key http.sslVerify)

On Windows:

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

Search for github address and remove it.

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.

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

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

If unsetting using

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

doesn't work for you .

Then check if the environment variable http_proxy and https_proxy are set . Check using this command : -

env | grep -i proxy

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

   https_proxy=""

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.

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

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

STEP 1:

STEP 2

  • Check your current branch git branch if 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

STEP 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 .git and repeat STEP 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

enter image description here

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.

For Ubuntu-like distro with your own git compiled: you might be missing libcurl4-openssl-dev. apt install libcurl4-openssl-dev then reconfigure, then make install

Try, this

git config --global --unset http.proxy

git config --global --unset https.proxy

We have an internally hosted git server (TFS) and I have Proxy environment variables set (HTTP_PROXY and HTTPS_PROXY). After having been working fine for some time, I suddenly started getting this error.

I ended up fixing it by setting our server in the NO_PROXY environment variable.

enter image description here

I think the solution mentioned above to remove the git credentials from windows credentials manager works. Basically it would have sourced with other git credentials in the cache. Flushing out the old ones would pave way to override the new credentials.

I guess that your git remote url has been set as SSH. You can set it as HTTPS:

git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git

Retry this command and there is prompt to enter username and password:

git pull

I was also facing the same issue But my issue was due to wrong credentials stored in my keyChain. So I solved by removing my old credentials from my keychain.

The error may be, the computer has saved a git username and password so if you shift to another account the error 403 will appear. Below is the solution

In Windows

you can find the keys here:

control panel > user accounts > credential manager > Windows credentials > Generic credentials

Next, remove the Github keys.

In mac

In Finder, search for the Keychain Access app > In Keychain Access, search for github.com > Find the "internet password" entry for github.com > Edit or delete the entry accordingly.

Replacing my remote from https to git worked for me.

Steps I followed can be found here

Finally, you can push your changes using git push -u origin <current_working_branch>