7

This is the Windows version of How can I run git push/pull commands with SSH verbose mode?

There are times where you just need to debug git's usage of SSH.

OpenSSH has a -v flag for verbose output, but how do you get git to use it?

How can I run git commands on Windows with SSH verbose mode?

cowlinator
  • 7,195
  • 6
  • 41
  • 61

2 Answers2

6

If your PATH is correctly set:

  • you don't need OpenSSH-Win64 (ssh is already included in Git)
  • you don't need to specify the full path for SSH

You need:

set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

Then

set GIT_SSH_COMMAND=ssh -vvv
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That's interesting. I knew that ssh was in "Git Bash", but didn't realize that it could be used directly from the Windows context. Is `Git\usr\bin\ssh.exe` another port of OpenSSH like OpenSSH-Win64? And since these tools are clearly useful, I wonder why only `Git\cmd` is added to the path when Git For Windows is installed. – cowlinator Nov 16 '17 at 22:34
  • By default, you get only git. But I find the other 200 commands quite handy as well. – VonC Nov 16 '17 at 22:37
3

You can force git to provide verbose ssh output with the "GIT_SSH_COMMAND" environment variable.

For example, to get verbose output from OpenSSH-For-Windows for a git clone command, just open a command prompt and enter

set GIT_SSH_COMMAND="C:\Program Files\OpenSSH-Win64\ssh.exe" -vvv
git clone <repo_ssh_url>

Note the location of the quotation marks.

cowlinator
  • 7,195
  • 6
  • 41
  • 61
  • This solved the problem of WHY I needed the verbose - because git, by default, had been using is own ssh, which used a different ssh-agent and ssh-add than the ones I had used to add the keys. So as soon as I set GIT_SSH_COMMAND as above, it worked. – Craig Hicks Feb 09 '22 at 22:07