【问题标题】:Identity fie in GIT_SSH_COMMAND for Windows not accessible无法访问 Windows 的 GIT_SSH_COMMAND 中的身份文件
【发布时间】:2020-12-18 04:26:07
【问题描述】:

这个命令对我不起作用。我需要将 tmp 身份文件传递给 ssh (git):

set "GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -F /dev/null -o IdentitiesOnly=yes -i C:\Users\some_user\AppData\Local\Temp\git-ssh-key" & git clone git@some_repo.git

我收到警告:

Identity file C:Userssome_userAppDataLocalTempgit-ssh-key not accessible: No such file or directory.

当我在身份文件路径中尝试双反斜杠时,出现错误:

debug1: Trying private key: C:\\Users\\assorvin\\AppData\\Local\\Temp\\git-ssh-key Load key "C:\\Users\\some_user\\AppData\\Local\\Temp\\git-ssh-key": invalid format

【问题讨论】:

  • 用转义引号包围路径怎么样? -c \"C:\Users\some_user\AppData\Local\Temp\git-ssh-key\" "
  • 同样的结果:不可访问:没有这样的文件或目录
  • 使用正斜杠怎么样?

标签: windows git ssh


【解决方案1】:

我使用 linux 风格的路径使其工作

set "GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no  -F /dev/null -o IdentitiesOnly=yes -i /C/Users/some_user/AppData/Local/Temp/git-ssh-key"&&  git clone git@some_repo.git

注意&& 之前缺少空格:它避免在前一个命令中添加额外的空格,这有时会出现问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-10
    • 2013-06-06
    • 1970-01-01
    • 2018-06-20
    • 2011-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多