Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: unable to connect to github.com: github.com[0: 140.82.121.4]: errno=Unknown error

I'm having a problem with my Git account. Every time I execute git push, I get the following error:

Git push error

I discovered that I'm working with an SSH URL:

SSH URL

I tried switching back to an HTTPS URL using the following commands:

git config --global url.https://github.com/.insteadOf git://github.com/
git config --global url."https://".insteadOf git://

However, it doesn't seem to change anything: example

I tried many options that I thought were solutions such as manually configuration of config file but nothing works.

like image 371
Ahlem Tbini Avatar asked Sep 09 '25 14:09

Ahlem Tbini


2 Answers

This error occurred because your git port is restricted.

You can get it fixed with the following command:

git config --global url.https://github.com/.insteadOf git://github.com/

By doing this globally it will also repair other issues where perhaps old repositories or other scenarios may be using git instead of https when the git:// port/protocol may not be functional now vs earlier.

like image 83
Amar Singh Avatar answered Sep 12 '25 04:09

Amar Singh


To use git with ssh, a different url syntax is needed, with git@<url> as url. According to your screenshot, the url should most likely look like this

[email protected]:ahlemtbini/blog_web.git

You can change it with the following command

git remote set-url origin [email protected]:ahlemtbini/blog_web.git

If you are using github, i recommend you to always use the url's listed under the code-button at the github-page of that repository. More information here

For more information about protocols used by git, read the page about git server protocols.

like image 23
Mime Avatar answered Sep 12 '25 05:09

Mime