简体   繁体   English

如何在Windows上以SSH详细模式运行git命令?

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

This is the Windows version of How can I run git push/pull commands with SSH verbose mode? 这是Windows版本的“ 如何使用SSH详细模式运行git push / pull命令”?

There are times where you just need to debug git's usage of SSH. 有时您只需要调试git对SSH的使用即可。

OpenSSH has a -v flag for verbose output, but how do you get git to use it? OpenSSH的详细输出带有-v标志,但是如何使git使用它呢?

How can I run git commands on Windows with SSH verbose mode? 如何在Windows上以SSH详细模式运行git命令?

If your PATH is correctly set: 如果您的PATH设置正确:

  • you don't need OpenSSH-Win64 (ssh is already included in Git) 您不需要OpenSSH-Win64(ssh已包含在Git中)
  • you don't need to specify the full path for SSH 您无需指定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

You can force git to provide verbose ssh output with the "GIT_SSH_COMMAND" environment variable. 您可以强制git使用“ GIT_SSH_COMMAND”环境变量提供详细的ssh输出。

For example, to get verbose output from OpenSSH-For-Windows for a git clone command, just open a command prompt and enter 例如,要从git clone命令的OpenSSH-For-Windows获取详细输出,只需打开命令提示符并输入

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

Note the location of the quotation marks. 请注意引号的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM