git won't connect to bitbucket server - Stack Overflow

admin2025-04-21  2

I'd like to authenticate git for bitbucket on WSL. I was able to successfully log in to GitHub, but not bitbucket. The bitbucket host can only be connected to via VPN, which I have on (I can see it in my browser).

When I "git clone https:bitbucketrepo..." from a windows cli, I get the expected git credential manager log in prompt and sign in via the browser and it works. But from wsl, it just hangs.

I tried to clone via ssh, but that hangs as well.

verbosity edit regarding ssh (note here I'm starting with an empty ~/.ssh/config file: I tried connecting via ssh with debug output for more transparency:

$ ssh -T [email protected] -vv
OpenSSH_9.6p1 Ubuntu-3ubuntu13.5, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /home/b2barry/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "custombitbucketurl" port 22
debug1: Connecting to custombitbucketurl [<IP ADDR>] port 22.
debug1: connect to address <IP ADDR> port 22: Connection timed out
ssh: connect to host custombitbucketurl port 22: Connection timed out

I tried changing the port to 443 as per the first answer in this thread here, but that times out as well. In that case I was using the following ~/.ssh/config:

Host custombitbucketurl
  Hostname custombitbucketurl
  Port 443

I'd like to authenticate git for bitbucket on WSL. I was able to successfully log in to GitHub, but not bitbucket. The bitbucket host can only be connected to via VPN, which I have on (I can see it in my browser).

When I "git clone https:bitbucketrepo..." from a windows cli, I get the expected git credential manager log in prompt and sign in via the browser and it works. But from wsl, it just hangs.

I tried to clone via ssh, but that hangs as well.

verbosity edit regarding ssh (note here I'm starting with an empty ~/.ssh/config file: I tried connecting via ssh with debug output for more transparency:

$ ssh -T [email protected] -vv
OpenSSH_9.6p1 Ubuntu-3ubuntu13.5, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /home/b2barry/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "custombitbucketurl.com" port 22
debug1: Connecting to custombitbucketurl.com [<IP ADDR>] port 22.
debug1: connect to address <IP ADDR> port 22: Connection timed out
ssh: connect to host custombitbucketurl.com port 22: Connection timed out

I tried changing the port to 443 as per the first answer in this thread here, but that times out as well. In that case I was using the following ~/.ssh/config:

Host custombitbucketurl.com
  Hostname custombitbucketurl.com
  Port 443
Share Improve this question edited Jan 22 at 23:42 Brian Barry asked Jan 22 at 23:05 Brian BarryBrian Barry 5685 silver badges25 bronze badges 7
  • 1 "Hangs" isn't enough to go on. Is it the DNS lookup or TCP connection that's hanging? Then that's a networking issue and not a code problem we can help with at all. Is the handshake hanging? Where, exactly? Etc. – Charles Duffy Commented Jan 22 at 23:15
  • 2 I'd suggest you start by going back to trying to connect with ssh, but this time using -vv to get detailed logs. Or talk to your local IT support staff -- only someone who can actually look over your shoulder and interactively give you directions can usefully work with the lack of details here. – Charles Duffy Commented Jan 22 at 23:16
  • 3 Okay, so DNS works but TCP times out -- that's definitely a networking problem. – Charles Duffy Commented Jan 23 at 0:03
  • 2 If you're trying to connect to a Bitbucket Server or Bitbucket Datacenter instance - not bitbucket.org - then you'll likely have to connect to a different port. The default SSH port on BB Server is 7999, but if that doesn't work then only your IT people can help you here. – Jim Redmond Commented Jan 23 at 0:16
  • 2 Port 443 timing out is surprising. (Being able to use it would require the engineering work to have a server that can recognize both SSH and TLS protocols and route between them, and I don't personally know if bitbucket server can do that, but if it couldn't that would be a different error, not a timeout). Can you hit that same URL in your web browser successfully? If you can, is that web browser configured to use a proxy or such? (Note that proxy auto-configuration is a thing; your IT may have set up the proxy without you knowing it). – Charles Duffy Commented Jan 23 at 14:02
 |  Show 2 more comments

1 Answer 1

Reset to default 0

I realized that this was a symptom of a greater issue when in a different context I noticed that making any HTTP request was failing while I was connected to the VPN. Since I am on Windows 11, I solved this by making the following edits to my .wslconfig, as outlined here.

[wsl2]
networkingMode=mirrored
dnsTunneling=true
转载请注明原文地址:http://anycun.com/QandA/1745224370a90440.html