Kevin Burke Kevin Burke - 1 year ago 219
Git Question

How can I run git push/pull commands with SSH verbose mode?

If I run "git push" with the GIT_TRACE=2 environment variable, I get the following:

09:25:28.098743 git.c:349 trace: built-in: git 'push' 'origin' 'master'
09:25:28.100261 run-command.c:341 trace: run_command: 'ssh' '' 'git-receive-pack '\''kevinburke/letter.git'\'''

Which is great except sometimes I get this error:

fatal: Could not read from remote repository.

I only get it intermittently so I'm not sure what's going on. I know ssh has a verbose mode:

-v Verbose mode. Causes ssh to print debugging messages about its progress.
This is helpful in debugging connection, authentication, and configuration
problems. Multiple -v options increase the verbosity. The maximum is 3.

It would be great if I could get
to run that ssh command with
turned on. Is there a way to enable this with environment variables or with config settings?

Answer Source

Put this in your ~/.ssh/config file:

Host <git server>

Subsequent git commands that interact with the server should produce desired debug output.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download