Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven release git-push "Host key verification failed."

When I am trying to have jenkins run a mvn -B release:prepare it gets to the point where it is to push changes to git, but fails with Host key verification failed. This is a local git repository.

At this time, jenkins is run as root. SSH keys have been created for root and they have been added appropriately to the git user's authorized_keys.

In fact, I can ssh to the build machine, su to root run git clone git@localhost:my-project.git clone successfully, create a branch and push that branch to origin successfully.

Another strange thing is jenkins can clone the repository successfully before mvn release:prepare is run.

When it tries to push, it gives the Host key verification failed. error.

I have dumbed the build down to be 1 execution step

git clone git@localhost:my-project.git
mvn -B release:prepare

Before responding, please don't suggest the git plugin or maven release plugin. These can't be installed.

like image 896
Matthew Kirkley Avatar asked Jun 11 '26 05:06

Matthew Kirkley


1 Answers

Figured it out.

While localhost was added to roots ~/.ssh/known_hosts file the actual IP of the box was not. Adding the public IP of the box to known_hosts resolved the issue.

like image 122
Matthew Kirkley Avatar answered Jun 14 '26 05:06

Matthew Kirkley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!