1

problem description:

I was using a company network and tried to get my own repo for some notes in my repo in github.com it failed. I tried to get more verbose log with the following commands and i got following details:

 GIT_TRACE=true \
GIT_CURL_VERBOSE=true \
GIT_SSH_COMMAND="ssh -vvv" \
GIT_TRACE_PACK_ACCESS=true \
GIT_TRACE_PACKET=true \
GIT_TRACE_PACKFILE=true \
GIT_TRACE_PERFORMANCE=true \
GIT_TRACE_SETUP=true \
GIT_TRACE_SHALLOW=true \
git clone  [email protected]:albertjone/Boostnotes.git
11:00:34.976275 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Library/Developer/CommandLineTools/usr/bin/git
11:00:34.976973 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/bin
11:00:34.977509 git.c:439               trace: built-in: git clone [email protected]:albertjone/Boostnotes.git
Cloning into 'Boostnotes'...
11:00:34.999871 run-command.c:663       trace: run_command: unset GIT_DIR; 'ssh -vvv' [email protected] 'git-upload-pack '\''albertjone/Boostnotes.git'\'''
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/xiaojguan/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /Users/xiaojguan/.ssh/id_rsa type 0
debug1: identity file /Users/xiaojguan/.ssh/id_rsa-cert type -1
debug1: identity file /Users/xiaojguan/.ssh/id_dsa type -1
debug1: identity file /Users/xiaojguan/.ssh/id_dsa-cert type -1
debug1: identity file /Users/xiaojguan/.ssh/id_ecdsa type -1
debug1: identity file /Users/xiaojguan/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/xiaojguan/.ssh/id_ed25519 type -1
debug1: identity file /Users/xiaojguan/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/xiaojguan/.ssh/id_xmss type -1
debug1: identity file /Users/xiaojguan/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
11:01:58.045282 trace.c:475             performance: 83.067792000 s: git command: /Library/Developer/CommandLineTools/usr/bin/git clone [email protected]:albertjone/Boostnotes.git

Things i've done

  • i've googled a lot but there seems no useful answers there.

  • i've checked that i was ok to telnet 22 in github.com

❯ telnet github.com 22
Trying 140.82.114.4...
Connected to github.com.
Escape character is '^]'.

asking

although it is ok to run git clone with http protocol. However, i am a little stubborn and I wonder what's cause and how to solve it.

1 Answer 1

0

The first thing the two sides do when setting up an SSH connection is to exchange version identifiers so they know what SSH version and possibly software the other side is using. In your case, you were able to establish a connection, but the server never sent their version identifier. That's probably because you have some MITM device on your network which snoops on all connections and didn't let that through.

You'll note that on my system, when I connect to github.com on port 22, I get the remote side's SSH banner:

$ nc github.com 22 </dev/null
SSH-2.0-babeld-cc5efb01

SSH and TLS (the security protocol used in HTTPS) can prevent an attacker from reading data or tampering with data undetected, but they can't prevent an attacker from tampering with data at all. An attacker can still prevent the connection from being established or tamper with it such that the connection will be aborted because tampering has been detected.

In this case, your company's MITM device is the attacker, and they're preventing the connection from working. You could try to work around it with a VPN, but if you can use HTTPS to achieve your goal, you might as well. That's less likely to get you in trouble, at least.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .