90

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.

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

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)
Wael
  • 1,640
  • 1
  • 9
  • 20
Merlin
  • 913
  • 1
  • 6
  • 4

21 Answers21

65

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.

  • 1
    Thank you for mentioning VPN! That was my problem. I disabled my VPN (Private Internet Access) and everything worked. – Mike Miller Mar 10 '19 at 21:02
  • My proxy wasn't running but I had environment variables `https_proxy` and `http_proxy` set in my shell. Things worked once I deleted the environment variables. – Saim Raza Jun 07 '23 at 19:13
44

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.

Marco
  • 2,445
  • 2
  • 25
  • 15
  • 1
    Doesn't work. At least not for git clone. (As push doesn't work for repository that is not cloned yet [and read-only anyway]) – Martini Bianco Feb 27 '18 at 13:14
  • This didn't work for me either, although it popped up the GitHub login dialog again it denied me with 403 – Matthew Lock Sep 21 '18 at 08:47
  • Check if you have permissions to clone the repository, check if you need to install any certificate. There are some configurations that you might need to do --> take a look at this: https://stackoverflow.com/questions/9072376/configure-git-to-accept-a-particular-self-signed-server-certificate-for-a-partic – Marco Sep 28 '18 at 09:05
  • 1
    This solution worked for me as it was stuck on using a different GitHub account. Once I was prompted to logon again I was able to do a "git push -u origin master" without access or not found errors. up vote. – Yogi Dec 20 '19 at 22:10
  • If I use this method, will I need to repeat the process for each github organisation? – Lauro235 Aug 14 '23 at 23:27
43

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.

lovubuntu
  • 979
  • 9
  • 16
Hao Kang
  • 474
  • 5
  • 5
  • 6
    I'm adding a comment about this because it came up in google first and I want to expand on the answer here. I was getting error: Push failed: Failed with error: fatal: unable to access 'https://github.com/username/repo.git/': Empty reply from server. For me as well as this answer this article from github helped: https://help.github.com/articles/changing-a-remote-s-url/#switching-remote-urls-from-https-to-ssh. I'm on OSX Yosemite – user115014 Dec 29 '14 at 01:10
  • Yes, same error here. Changing the protocol from `http` to `git` resolved the issue and I could upload my repository. – Stefan Rein Jun 01 '17 at 08:44
17

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.

izilotti
  • 4,757
  • 1
  • 48
  • 55
11

Try, this

git config --global --unset http.proxy

git config --global --unset https.proxy

Ratnesh Shukla
  • 1,128
  • 13
  • 24
6

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=""
Natesh bhat
  • 12,274
  • 10
  • 84
  • 125
3

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.

ddsultan
  • 2,027
  • 1
  • 19
  • 19
3

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.

Ayoub Boumzebra
  • 3,885
  • 3
  • 21
  • 37
2

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)

2

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

Sagar
  • 5,273
  • 4
  • 37
  • 50
2

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.

Suhas R
  • 31
  • 5
1

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

treiff
  • 1,246
  • 14
  • 24
Niki Dimitrov
  • 86
  • 1
  • 5
0

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.

Ali Tourani
  • 1,170
  • 3
  • 21
  • 31
  • What is a "proxy tunnel"? How did you configure it? Can you [edit] your answer to make that clear? – Artjom B. Oct 22 '18 at 20:31
  • I just used a free vpn application to access a private network and send my request remotely through public networks. – Ali Tourani Oct 23 '18 at 08:51
  • 1
    To recap, your issue was that you could not access BitBucket (or only a single port), because it was blocked by your ISP/country for some reason and you've used VPN to work around this restriction. Keep in mind that proxies can usually look into the traffic even if the connection would be normally encrypted. Do this only if you trust the proxy provider. VPNs are different and provide a proper tunnel, so there you don't need as much trust. – Artjom B. Oct 23 '18 at 16:51
0

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

dgan
  • 1,349
  • 1
  • 15
  • 28
0

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

Robert Brooker
  • 2,148
  • 24
  • 22
0

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
DavidLin3
  • 353
  • 3
  • 7
0

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.

sharma_kunal
  • 2,152
  • 1
  • 28
  • 28
0

For Windows users...

I received an error of the same kind.

fatal: unable to access 'https://github.com/repo.git/':
Could not resolve host: github.com 

This occurred after the repo was transferred to a different organisation.

On running git remote -v I could see that my fetch and push destinations were pointing to the correct location. (If you don't see the correct destination, the command to set it is git remote set-url origin <github-repo.git> ).

What fixed it for me was running ipconfig /flushdns in my command terminal.

In my situation, I didn't need to retype any credentials or set a proxy as other people have had to.

Lauro235
  • 121
  • 1
  • 8
-1

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

Dmitri Algazin
  • 3,332
  • 27
  • 30
-1

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>

Nithin Prasad
  • 79
  • 1
  • 2
  • 10
-1

VS Code

  • CMD+Shift+P -> Developer: Reload Window

This is worked for me. You can try this command

Furkan Cetintas
  • 600
  • 5
  • 13