I am under a proxy and I am pushing in to git successfully for quite a while.
Now I am not able to push into git all of a sudden.
I have set the RSA key and the proxy and double checked them, with no avail and git is throwing me the error shown in the title of the page.
问题:
回答1:
The reason could be the firewall modification as you are under a network.(In which case they may deliberately block some ports)
To double check if this is the reason ... do
ssh -T git@github.com
this should timeout.
If that's the case use http protocol instead of ssh this way
just change your url in the config file to http.
Here is how :-
git config --local -e
change entry of
url = git@github.com:username/repo.git
to
url = https://github.com/username/repo.git
回答2:
Basic URL Rewriting
Git provides a way to rewrite URLs using git config. Simply issue the following command:
git config --global url."https://".insteadOf git://
Now, as if by magic, all git commands will perform a substitution of git://
to https://
source: git:// protocol blocked by company, how can I get around that?
回答3:
For people coming to this page from Google. For my case none of the suggested solutions worked so I tried to fix it myself and I got it resolved.
For me I am getting this error on my AWS EC2 UBUNTU instance, what I did to resolve it was to edit the git config.
sudo nano ~/.ssh/config
And I added the following
Host github.com
Hostname ssh.github.com
Port 443
Then, run the command ssh -T git@github.com
to confirm if the issue is fixed.
Hopefully this helps anyone else who's having the same issue I did.
回答4:
Execute:
nc -v -z <git-repository> <port>
Your output should look like:
"Connection to <git-repository> <port> port [tcp/*] succeeded!"
If you get:
connect to <git-repository> <port> (tcp) failed: Connection timed out
You need to edit your ~/.ssh/config file. Add something like the following:
Host example.com
Port 1234
回答5:
I was having this same issue, but the answer I found was different, thought someone might come across this issue, so here is my solution.
I had to whitelist 2 IPs for port 22
, 80
, 443
, and 9418
:
192.30.252.0/22
185.199.108.0/22
In case these IP's don't work, it might be because they got updated, you can find the most current ones on this page.
回答6:
Quick workaround: try switching to a different network
I experienced this problem while on a hotspot (3/4G connection). Switching to a different connection (WiFi) resolved it, but it's just a workaround - I didn't get the chance to get to the bottom of the issue so the other answers might be more interesting to determine the underlying issue