Ubuntu – Really verbose way to test Git connection over SSH

command linegitssh

When using GIT, I have problems with using GIT over SSH, and since it works just fine both from work, and at home with a different modem, it's obviously my home modem that is acting up. I have no problems connecting over HTTP.

So, I'm assuming it is an SSH problem, but I'm no expert at using it directly. Is there any command I can run which sets up a "test" connection, and lets me know exactly when and where along the line the problem occurs?

Pretty much all "larger" commands (such as fetch, clone, or push with much data) from git (even when run with -v) just "hang" in the middle of connecting remotely with no indication as to why they have stopped, so they are of no use.

Is there any way I can get more details on what is happening in the SSH connection?

Best Answer

Environment variable

From Git version 2.3.0, you can use the environment variable GIT_SSH_COMMAND and pass the -v verbose argument like this:

GIT_SSH_COMMAND="ssh -v" git clone example

To be extra verbose, make it -vvv:

GIT_SSH_COMMAND="ssh -vvv" git clone example

Git config

From Git version 2.10.0, which will in Ubuntu 17.04's repos, you can save this configuration globally, or per repo as in this example:

git config core.sshCommand "ssh -vvv"
git pull
Related Question