我正在 Windows 10 的 Bitnami Gitlab VM 机器的 Windows CMD 中尝试以下命令。
git clone git@192.168.1.10:user/project.git
它在 Git Bash 中有效,但同样的命令不适用于 Windows CMD。
我怀疑在 Windows CMD 中使用时 ssh 正在寻找错误的键,输出是:
Permission denied (publickey)
该命令在 Git Bash 终端中有效,但我喜欢使用 Windows CMD。
我该如何解决这个问题?
最佳答案
I suspect when used in Windows CMD ssh is looking for wrong key
你不必怀疑。你可以看到它。
检查:
- 你的
PATH
引用<git>/usr/bin
- ssh 确实在哪里
ssh.exe
来自<git>/usr/bin
-
HOME
设置为您的.ssh
的父文件夹是
然后输入:
ssh -Tv git@192.168.1.10
如果使用了错误的 ssh key ,将其定义在 .ssh/config
file 中.
Host mygitserver
Hostname 192.168.1.10
User git
IdentityFile "/C/path/to/my/private/key"
关于windows - Git 命令在 Windows CMD 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42868703/