windows - Git 命令在 Windows CMD 中不起作用

标签 windows git bash cmd

我正在 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/

相关文章:

c++ - MSVC 函数名修饰

git - move 后如何修复本地 git repo 的路径?

git - repo 同步特定文件夹

bash - 在 JAR 中的文件中搜索

windows - VS Code - Cygwin 作为集成终端

c++ - Windows 中用于提供 HTML 内容的自定义 URL 协议(protocol)

git - 如何关闭 git 自动更正?

python - 使用 Python Paramiko 通过 SSH 将输入/变量传递给命令/脚本

bash nohup 有两个命令

c# - 我正在使用 dll 的头文件在 c# 中为 c++ 编写包装器库,但无法弄清楚如何转换类型。