While trying to push a release to Maven, I am getting several errors including:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
and
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to commit files
Provider message:
The git-commit command failed.
Command output:
So this is really just a brain dump of the process I had to go through to push a release for an open source project hosted on git into the Sonatype maven repo. Almost everything here has been covered in separate StackOverflow questions, but for those (like me) doing this for the first time, an overview is useful.
The whole process is actually just two commands:
However, it's the fiddly details that caught me out. So this is the process I needed to follow:
Permission denied (publickey). error.git-commit command failed. error.mvn -Pgpg gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=pom.xml -Dfile=pom.xmlThis is the ~/.m2/settings.xml file.
<settings>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>username</username>
<password>password</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>username</username>
<password>password</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.passphrase>password</gpg.passphrase>
<gpg.keyname>12345678</gpg.keyname>
</properties>
</profile>
</profiles>
</settings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With