Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-release-plugin does not use ssh key provided in job config or/and .ssh/config

I have a jenkins job that has a git repo as scm and jenkins connect to the latter via ssh.

Everything is fine when it comes to the clone command, I've set the proper key in .ssh/config and it gets used by Jenkins.

but when it comes to performing a maven release with the plugin maven-release-plugin (tried version 2.3.2 and 2.5.1) it fails with a Access denied.

[INFO] Executing: /bin/sh -c cd /path/slave/workspace/foo-27 && git push ssh://[email protected]/mfx/project.git refs/heads/develop-27:refs/heads/develop-27
[INFO] Working directory: /path/slave/workspace/foo-27

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.447s
[INFO] Finished at: Fri Oct 10 20:00:06 GMT 2014
[INFO] Final Memory: 15M/222M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /path/slave/workspace/foo-27/pom.xml to /bld/shared/jenkins/jobs/foo-27/modules/bar$project/builds/2014-10-10_19-59-14/archive/bar/project/27.1.1.0-SNAPSHOT/project-27.1.1.0-SNAPSHOT.pom

Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project project: Unable to commit files
Provider message:
The git-push command failed.
Command output:
Access denied.
fatal: Could not read from remote repository.

When I run the same git push from the same server in the same directory as pwd, the command works perfectly.

Also, in my job definition, I'm using a credential that sets the key for user git.

I'm under the impression that the maven-release-plugin is not using the ssh key defined in .ssh/config...

What do I need to change or do to make it work?

like image 674
vinni_f Avatar asked Oct 10 '14 20:10

vinni_f


1 Answers

Turns out that the problem was not with the ssh key. The message being "access denied" and not "permission denied" pointed out that the git repo permissions were insufficient to be able to create a tag.

like image 106
vinni_f Avatar answered Oct 17 '22 00:10

vinni_f