Reputation: 41
When I try to set up a job to build a project from a git repository I get an error:
Failed to connect to repository : Command "git ls-remote -h ssh://git@ssh://[email protected]/path/to/repos.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
In Jenkins, I installed the SSH Agent plugin and the Git plugin.
I can add a build step with the following:
git ls-remote -h ssh://[email protected]/path/to/repos.git HEAD
Run the build and that works!
This tells me that everything is setup properly:
It seem this doesn't work for Source Code Management, but for pre-build/build/post-build operation it does.
Is there a problem with the Ssh agent not being activated before the build process?
Thanks in advance to anyone who can help.
Upvotes: 4
Views: 2272
Reputation: 3500
"Is there a problem with the SSH agent not being activated before the build process?" - Yes, and it's annoying.
I did read 'somewhere' in my hunting that they are planning to make the SSH agent wrap around git and other plugins correctly in the future.
If you run a simple shell command with the SSH Agent setup you will clearly see it start and stop before and after the shell command in the console output for the build, this does not happen when git details have been entered.
Just continue to use the build steps as described for now...
Upvotes: 2