windows - 无法访问 Windows 的 GIT_SSH_COMMAND 中的身份文件
问题描述
这个命令对我不起作用。我需要将 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
解决方案
我使用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
请注意 : 之前缺少空格,&&
这样可以避免在前面的命令中添加额外的空格,这有时会出现问题。