Reputation: 191
Whenever I try and perform an operation using git
(e.g. clone
, pull
, or push
) over SSH the git client seems to hang and time out indefinitely (I've left it running for half an hour to no avail). I have my SSH keys loaded (using BitBucket). I am able to perform anything I need via HTTPS, and SSH is the only thing that appears to break.
Here is some console output from an attempted pull
$ GIT_TRACE=1 git pull
16:44:05.679911 git.c:344 trace: built-in: git 'pull'
16:44:05.681453 run-command.c:334 trace: run_command: 'fetch' '--update-head-ok'
16:44:05.686650 exec_cmd.c:120 trace: exec: 'git' 'fetch' '--update-head-ok'
16:44:05.697849 git.c:344 trace: built-in: git 'fetch' '--update-head-ok'
16:44:05.703211 run-command.c:334 trace: run_command: 'ssh' '-p' '7999' '[email protected]' 'git-upload-pack '\''/ei/myProject.git'\'''
Anyone have any idea what could be happening?
Upvotes: 4
Views: 7360
Reputation: 111
If you have a machine where git is working, you can compare the ssh configuration file of the nonworking to the working machine.
The ssh config file is located at /etc/ssh/ssh_config
In my case, git was working fine on Windows but not WSL2. In windows the port was set to 22 while in WSL2 it was set to 2200. I changed it to 22 and was able to continue using git on wsl2.
Upvotes: 0
Reputation: 1329092
7999 is a non-standard port which is likely to be blocked.
If port 22 is not blocked (and that is a big if), then you can consider an ssh tunneling:
ssh -R 7999:localhost:22 [email protected]
Upvotes: 1