HeyBoo
HeyBoo

Reputation: 145

"Failed to connect to github.com port 443: Connection timed out" when pushing to remote repository

I've 'googled' and 'stackoverflowed' so much but I haven't found a solution for my problem.

I'm on Ubuntu and try for the first time git.

I did:

sudo apt-get install git

and created an account on the website (and verified the email, everything is ok). Then I

git config --global user.name "<my_name_here>"

and

git config --global user.email "<my_email_here>"

Then I went to the website and created a public repository called gittest (I did not initialized with a README nor added licence or .gitignore). Then I

mkdir gittest

on my desktop and

cd /Desktop/gittest

Then:

echo "# gittest" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/<my_username>/gittest.git

and finally

git push -u origin master

And that's the tragedy: by clicking enter after written git push -u origin master it does nothing and after (many) seconds it returns an error message:

fatal: unable to access 'https://github.com//gittest.git/': Failed to connect to github.com port 443: Connection timed out

EDIT

If I

echo "$http_proxy"

or

echo "$https_proxy"

nothing happens (the terminal returns me an empty row).

Upvotes: 8

Views: 51015

Answers (3)

Nitin Jadhav
Nitin Jadhav

Reputation: 527

The solution is to override the SSH settings.

$ vim ~/.ssh/config

# You can also manually open the file and copy/paste the section below
# Add section below to it
Host github.com
  Hostname ssh.github.com
  Port 443

Then try

$ ssh -T [email protected]
Hi ! You've successfully authenticated, but GitHub does not
provide shell access.

Now try

git push -u origin master

This should be successful!!!

For more information check the reference : Click Here

Upvotes: 0

Marcos Riveros
Marcos Riveros

Reputation: 544

If you are behind a proxy, you need configure that:

http.proxy

Override the HTTP proxy, normally configured using the http_proxy, https_proxy, and all_proxy environment variables (see curl(1)).

In addition to the syntax understood by curl, it is possible to specify a proxy string with a user name, but no password, in which case Git will attempt to acquire one in the same way it does for other credentials. See gitcredentials(7) for more information. The syntax thus is [protocol://][user[:password]@]proxyhost[:port]. This can be overridden on a per-remote basis; see remote.<name>.proxy

Perfect!

For solving the “Failed to connect to github.com port 443: Timed out” message we need to run:

git config --global http.proxy

http://domain.local\username:password@proxyServer:8080

where username is your username in proxy and password is your password

Done! You can check if the setting was applied running git config --global http.proxy

Additional information:

git config

Upvotes: 1

Charitra Agarwal
Charitra Agarwal

Reputation: 492

Try running the following command

git config --global --unset https.proxy

Upvotes: 3

Related Questions