问题描述
我正在Windows 10上使用Git,但我不仅在Windows Shell上,而且在PowerShell,Git Bash和Cygwin终端上也遇到错误,对此我感到非常沮丧。
我想像这样克隆一个Gerrit存储库:
git clone "ssh://[username]@[host]:[port_number]/repository"
我总是收到以下错误消息
git: '[port number]' is not a git command. See git --help
例如(不是真实的代码,但非常相似):
git clone "ssh://aruiz@swrepo4:29418/testing/ecutests"
我明白了
git: '29418' is not a git command. See git --help
为什么Windows解释器会不断理解端口号,因为git参数超出了我的范围。无论如何,我想问你们是否有人知道原因。不幸的是,我在互联网上找不到其他人遇到同样的问题。
2020/12/12更新:终于可以了!这是我更改的内容,我相信是引起问题的原因:环境变量'GIT_SSH'指向git.exe。我将其更改为ssh.exe(C:\ Users \ AppData \ Local \ Programs \ Git \ usr \ bin \ ssh.exe)。我还更新到了最新的Git版本:2.29.2.windows.2
解决方法
但是为什么在i
命令中需要双引号("
)?你不需要这个尝试以下操作,不要使用双引号:
git clone
通过这种方式,端口号(默认为Gerrit,侦听端口29418以进行SSH访问)将被识别为 git命令!