19

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

I have even tried with the new repo but the result is same.

codebased
  • 6,945
  • 9
  • 50
  • 84

9 Answers9

18

grr...

The problem got fixed after restarting my Mac computer.

codebased
  • 6,945
  • 9
  • 50
  • 84
10

Maybe mine was another problem but the same output: "Empty reply from server". I resolved it by doing

git fetch origin --prune

After that, push was successful.

Oleg Oleg
  • 525
  • 6
  • 10
1

You can restart you computer, or else restart your local server.

kayess
  • 3,384
  • 9
  • 28
  • 45
Wilmar PR
  • 21
  • 3
  • 1
    The same problem happened to me today on OS X Yosemite 10.10.5 with git version 2.5.4 (Apple Git-61) trying git push to bitbucket. Just restarted computer and the error is gone. Any ideas what's the nature of this bug? – Anton Malyshev Aug 05 '16 at 14:45
0

I had a similar problem with Git. I figured it was a problem pertaining to Git Credentials managed by Windows.

Here's what I tried step by step

  1. Restarting my computer
  2. Restarting my network device
  3. Deleting credentials from credential manager on windows' control panel
  4. Redefining Remote URL by using

    git remote set-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.

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.

0

Answered here: https://stackoverflow.com/a/27352176/4402501

In short:

  1. Add ssh-key to your github repository (instructions here).
  2. Switch your remote URL from HTTPS to SSH (instructions here).
  3. Push it like it's hot.
Alon Lavian
  • 1,149
  • 13
  • 14
0

I just delete the saved hosts(related to GitHub) in ~/.ssh/known_hosts. Open a new terminal, this issue disappeared.

user1577263
  • 449
  • 5
  • 8
0

I'm a Windows user and I was having the same issue after connecting to another wifi and then connect back in my house.

I checked for my remote with this command

git remote -v

and everything seems ok, so it was not an issue with the remote. Then I finally figured it out how to make it work, this is what I did to solve it:

  1. Restart my computer
  2. Unplug and plug back my router so it restart ( not reset factory )

After that i tried again

git push origin myBranchName

exactly the same way before but now it worked !!!

Jeyson Mg
  • 150
  • 1
  • 6
0

I have the same problem in Centos:

  • only when running the script
  • terminal execution is normal
  • use git:// instead of https:// for git clone, this worked for me
crayon
  • 147
  • 1
  • 3
0

I don't know if this will help people.

But whenever this happens to me, it is usually fixed when I remove the credentials for the git repository/account from the Credential Manager (Windows).

After you remove the credentials, git will prompt you to re-authenticate yourself, either by an account or by a personal access token.

No restart required.

I do not have experience with MacOS or Linux but I'm sure there must be similar locations that cache/store these credentials.

GaidinD
  • 354
  • 6
  • 18