'"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
- How do I resolve? Please help
EDIT
If I
echo "$http_proxy"
or
echo "$https_proxy"
nothing happens (the terminal returns me an empty row).
Solution 1:[1]
maybe 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..proxy
Perfect!
For solve 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 info:
git config
Happy scripting!
Solution 2:[2]
Try running the following command
git config --global --unset https.proxy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Charitra Agarwal |