简体   繁体   中英

Identity fie in GIT_SSH_COMMAND for Windows not accessible

This command not working for me. I need to pass tmp identity file to 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

I get a Warning:

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

When I try double backslash in identity file path, got a error:

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

I made it work using linux-style path with

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

Note the lack of space before the && : it avoid adding an extra space to the previous command, which can be sometimes problematic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM