Permission denied (publickey) when setting up Jenkins

As I commented, specifying the HOME environment variable is key, when using ssh protocol.
Since Windows doesn’t have a HOME, you need to define it explicitly, to whatever directory you want.

However, Vestnik comments:

I’ve specified to override HOME on the windows slave node to point it to C:\jenkins.
I’ve put correct id_rsa under the C:\jenkins\.ssh but still have this issue.
My slave agent running as service under SYSTEM account.

Two advices:

  • you need to make your slave display ‘set‘ in order to check if HOME is defined when used with the SYSTEM account.
    If it is not, that may mean you need to add that variable to the “system environment variables”, not the “user environment variables”.

display env from the job definition

  • Don’t forget to have both id_rsa and id_rsa.pub in the %HOME%\.ssh directory: you need both public and private ssh keys. (as mentioned in “git clone with ssh issue“)

If you have a parametrized build, you also can define HOME that way and check if your slave picks up the right value for HOME:

define custom variables

Leave a Comment