Failed to load SSH key ssh-add fails on windows

Hello. 

I am trying to setup the build feature "SSH agent" to be able to push changes back to the repository as part of the build. Unfortunately I get the error "Failed to load SSH key '<keyname>'" and the push fails. Somehow it seems that the ssh-add command looks for a Unix path which cannot be found:

I uploaded the log parts of the corresponding build via web-form (failed-to-load-ssh-key-logs.txt) but it does not help me much on fixing the issue. It seems that ssh-add looks for a unix file system path that obviously does not exist on windows: 

[2019-02-18 10:36:39,904] WARN - .SshAgentBuildFeatureAgentPart - 'ssh-add D:\TeamCity\BuildAgent\temp\buildTmp\teamcity5850665174356021089sshKey' command failed
stderr: ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
exit code: 1

Is this a known issue? Does anybody know hot to get this running in windows?

Greetings
Daniel

 

0
2 comments
Avatar
Permanently deleted user

I was able to solve the issue on my own but I strongly doubt that this should be the default behavior. 

I needed to set the environment variable SSH_ASKPASS to point to "C:\Program Files\Git\mingw64\libexec\git-core\git-askpass.exe". This somehow overrides the unix path with the given correct one. Not sure if this is a ssh-add bug on windows as it should not search in this unix path or if it would be the duty of TC to set this. 

I added a environment variable parameter on my project in TC to apply it automatically everywhere (as all our agents are set up with this path)

0
Avatar
Permanently deleted user

There are some hints in the documentation that windows isn't the most favorite OS for this: https://confluence.jetbrains.com/display/TCD18/SSH+Agent pointing to https://youtrack.jetbrains.com/issue/TW-42707 

The path that cannot be found (/usr/lib/ssh/ssh-askpass) isn't there for me either using the bash / ssh that comes with the Git installer (the folder is there but not ssh-askpass). Maybe it is there if you use cygwin's setup.

So your workaround looks ok to me. If it works: even better :)

0

Please sign in to leave a comment.