简体   繁体   中英

ssh: connect to host x.x.x.x port 7999: Connection timed out - Git for Windows

I'm completely new working with repositories.

I have a repository that I need to clone from BitBucket (not BitBucket.org, the company where I'm working has an Enterprise BitBucket) using Windows 10 as Operating System.
I've followed the instructions given from Attlasian Documentation but so far I have not been able to clone the repository because of the Message in the Title :

ssh: connect to host x.x.x.x port 7999: Connection timed out

I've been researching, and the main reason is because I'm an under a proxy (company's proxy), so I setup the proxy as follow:

Taken from this question - Getting git to workwith a proxy server and many more entries in StackOverflow

In Git Bash:

I used the command

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

This command update the file .gitconfig located in the folder %userprofile% by adding this:

[http]
    proxy = http://proxyuser:proxypwd@proxy.server.com:8080`

I have also tried the following, as some entries suggested:

[https]
    proxy = http://proxyuser:proxypwd@proxy.server.com:8080`

In my PC:

I added the http_proxy environment variable with value " http://myUser:myPass@myProxy:8080 ", and also tried in many ways ( https_proxy , HTTP_PROXY , HTTPS_PROXY , I was trying all of these because some question where answered by the UperCase issue or others had to add https ). The company proxy is HTTP , but the company repository is HTTPS .

Also, I contacted to the Network Manager (actually, not really sure about his position) and told me that I need to check the setup of the proxy because I'm trying to connect directly from my PC to the Host (not going through the proxy - see image), showing me this image:

https://i.stack.imgur.com/IVcZR.jpg

In order to corroborate if I am doing something wrong in any other configuration, I've made the same configuration explained in the Attlasian Documentation in my own PC (not from work) and without a proxy. I could clone the repository. So, the setup of the proxy is the problem.

So, I hope you can help me with this issue, I've been stuck for days researching about this, not being able to solve it.

First you mention ssh: this has nothing to do with an https proxy.

ssh is normally on port 22, so make sure your ssh url used to reference your company's BitBucket repo is:

git@mycompany:myrepo.git
or:
git@mycompany:agroup/myrepo.git

if you still see mention to port 7999, check if you have a %HOME%/.ssh/config file which would force that port on ssh connection.
( HOME is generally set to %userprofile% )

But in any case, having an https proxy should have no bearing on an internal ssh connection.

Since ssh port is blocked, the OP had to use a socks proxy, following " Using a socks proxy with git for the http transport ":

ALL_PROXY=socks5://127.0.0.1:xxxx git clone https://github.com/some/one.git

It is supported by Git since Git 2.7 :

git config http.proxy socks5://127.0.0.1:xxxx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM