You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The basic problem I am trying to solve is that I would like to use git within my WSL 2 environment. When I try pushing to my remote repository I get the following message,
$ git push
ssh: connect to host [...] port 22: Connection timed out
After a bit of searching I now understand that the issue is with my ssh cconection. In Issue 5224 a list of 4 things to try is given,
Check if you can ssh using IP
Do a debug with ssh -vvv
Check if you can resolve the DNS name with nslookup
Make sure the nssswitch.conf is good.
I found that my ssh does work when I use an IP address rather than the machine name, i.e., I can ssh when I apply suggestion (1).
However I cannot see how this approach could be applied within the context of git. And in any case I would prefer to be able to use machine names rather than IP addresses when I am logging in to other machines on my network.
A couple of other remarks that may be relevant.
I am connecting to machines on my network using a VPN. Not sure if this could also be part of the issue.
I do not have this issue at all when I am in my WSL 1 environment. I.e. in WSL 1 I can ssh using machine names and git works as expected.
The text was updated successfully, but these errors were encountered:
I have resolved this now. At some point I disabled automatic generation of /etc/resolv.conf. I have changed my WSL 2 environment so that /etc/resolv.conf is now automatically generated (as it should be by default). This resolved the git / ssh issue that I was having.
I see that WSL2 FQDN hostname and the windows hostname is same. This is probably causing the hostname to IP resolution to pickup the IP of the localmachine (Windows Machine) and thus not allowing to connect to a port opened in WSL2.
I am not sure if enabling mirroring instead of NAT will resolve this as it will merge the 2 (WSL and Windows) interfaces into 1 and thus make all ports available to each OS. Can somebody shed light on this?
Changing hostname can be tried out but what implications will it have (Mirrored vs NAT setup)?
The basic problem I am trying to solve is that I would like to use git within my WSL 2 environment. When I try pushing to my remote repository I get the following message,
After a bit of searching I now understand that the issue is with my ssh cconection. In Issue 5224 a list of 4 things to try is given,
I found that my ssh does work when I use an IP address rather than the machine name, i.e., I can ssh when I apply suggestion (1).
However I cannot see how this approach could be applied within the context of git. And in any case I would prefer to be able to use machine names rather than IP addresses when I am logging in to other machines on my network.
A couple of other remarks that may be relevant.
The text was updated successfully, but these errors were encountered: