105

When l try to use git push, an error reports:

Fatal: fatal: unable to access 'https://github.com/xxx': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

My git version is 2.16.2 for windows

It worked well before this day, and reinstalling git seems to not work.

Can anyone help me with that? Thanks in advance!

9
  • 4
    Something is blocking the connection to github. It is likely some kind of firewall, either on your machine or in your network. If it works with a browser on same machine then the browser is probably using a proxy and you need to configure git to use this proxy too. Mar 18, 2018 at 7:18
  • 1
    There are already enough information out there which show how to use a proxy with git, like Getting git to work with a proxy server. If it worked before but does not work now then you need to figure out first what you have changed in your configuration or what has been changed in the network so you can configure the proxy properly. Mar 18, 2018 at 7:27
  • Could you do where git and git --version to verify that an old version is not in the path before the new one you installed? Because a version >2.16 should be used since github invalidate some security communication protocols 1 or 2 weeks ago...
    – Philippe
    Mar 18, 2018 at 10:21
  • @Philippe where git = F:\Git\mingw64\bin\git.exe F:\Git\cmd\git.exe and git --version = git version 2.16.2.windows.1
    – Rosmee
    Mar 18, 2018 at 11:23
  • should l switch to previous version?
    – Rosmee
    Mar 18, 2018 at 11:39

10 Answers 10

122

If you are behind a proxy, try the following:

git config --global --add remote.origin.proxy ""
5
  • 8
    I had to put my proxy inside the "" like "myproxy.domain:port" and then it was working better. Mar 12, 2019 at 18:59
  • 35
    git config --global --unset-all remote.origin.proxy worked for me.
    – Jess
    Jul 30, 2019 at 1:09
  • 6
    git config --global http.sslVerify false works for me
    – JerryYu
    Mar 17, 2021 at 10:34
  • git config --global --unset-all remote.origin.proxy git push Mar 17, 2022 at 15:35
  • This helped me a lot! Mar 24, 2022 at 9:25
49

After reinstalling Git did nothing, I found an issue on GitHub that helped me solve it.

In your terminal run this command first:

git config --global http.sslBackend "openssl"

Then this one:

git config --global http.sslCAInfo "C:\Program Files\Git\mingw64\ssl\cert.pem"

You may need to change your path depending on where you have it installed.

7
  • 16
    I just ran git config --global http.sslBackend "openssl" and it allowed me to push. Jul 20, 2018 at 2:14
  • 3
    same here on a MacOS, ' git config --global http.sslBackend "openssl" ' helped me already.
    – novski
    Jul 20, 2018 at 8:08
  • 6
    Setting sslVerify to false is dangerous and effectively defeats the purpose of HTTPS/SSL.
    – vcsjones
    Jul 20, 2018 at 12:24
  • 2
    I just ran the first command and it worked. I was having the issue while pushing data to repo Feb 19, 2019 at 13:41
  • 2
    Worked for me. I love how getting anything done in git requires me to spend half my life learning incomprehensible magic commands.
    – Neutrino
    Sep 16, 2020 at 12:00
29

Opening a new terminal session worked for me

14
git config --global --add remote.origin.proxy "127.0.0.1:(proxy http port number)"

in ch

enter image description here

add image @afder cc's

1
  • 1
    For me, change another jms address solves the issue
    – Liu Hao
    Jan 19, 2022 at 15:11
13

if your using proxy try to go to run and enter inetcpl.cpl then connections then Lan settings then advance and now you see your proxy, use the http one.

then open Git Bash then enter this command

$ git config --global http.proxy 

if theres no output of it then the proxy in Git Bash is not set then set it with these command and use proxy and port shown in the 1st paragraph

$ git config --global http.proxy proxyaddress:port

then enter this command again

$ git config --global http.proxy 

and there you go it is set

to reset the proxy on Git Bash just enter this command

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

i was also having these problem lately i was using psiphon vpn on desktop as a newbie it was also hard to find this solution glad i could help. :)

2
  • Thanks. This worked for me. If you are under a VPN, to get the proxyaddress and port open up your VPN application and check the logs. Usually it is 127.0.0.1:PORT Jan 12, 2020 at 15:25
  • 1
    Thanks, git config --global http.proxy 127.0.0.1:8080
    – Ismynr
    Oct 26, 2020 at 2:39
6

Sometimes, it can be simply because your system was unable to connect to GitHub, possibly because you were not connected to the Internet (or you had a lousy connection).

(It's true - this problem can be reproduced. Just disconnect your LAN/WiFi and then do git pull, you will get the same error).

PS: This happened with me. Sometimes the problem is your internet connection rather than configs.

2
  • Worked for me. Close internet connection - reconnect and restart IDE
    – Tim Maes
    Jan 14, 2021 at 8:20
  • This worked for me. I had to physically disconnect my LAN cord and reconnect it. I have a backup connection via Wi-Fi and it probably got a new IP address from there. No issues doing any git commands after.
    – kobowo
    Mar 17, 2022 at 15:57
4

I solved this same problem changing the git url in 'clone' step - use SSH instead of HTTPS link.

2
  • 1
    you helped, i tried all of solutions mentioned above, the only one solved my problem is yours. Nov 1, 2020 at 11:26
  • I did it from the suggestions above for the first time and I got one error again. But I saw your answer and I did it with SSH again, and now it is fixed. Thanks:) Jan 7 at 14:11
3

I recently installed git 2.24.1 and not sure what changes I made, but it was not allowing me to clone or push without admin account on my machine.

This solved my issue:

  1. In your terminal run this command first:

    git config --global http.sslBackend "openssl"
    
  2. Then this one:

    git config --global http.sslCAInfo "C:\Program Files\Git\mingw64\ssl\cert.pem"
    
1
2

For Shadowsocks users:

  1. Click the Shadowsocks icon, go Preferences:

enter image description here

  1. Suppose that your local proxy listen port is XXX, run this:
git config --global --add remote.origin.proxy "127.0.0.1:XXX"
1

I tried many answers and it still failed with the same error, including the following one:

git config --global http.sslBackend "openssl"

However, I tried reverting that by:

git config --global --unset-all http.sslBackend

then restart my laptop, and everything started working again.

I'm not exactly sure what went wrong initially, but lesson learned is that the correct config isn't the same for everyone.

Not the answer you're looking for? Browse other questions tagged or ask your own question.