Reputation: 305
I'm trying to deploy my local artifact into the nexus staging repository but the task is failing with the below error.
gpg: no default secret key: No secret key
gpg: signing failed: No secret key
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.886 s
[INFO] Finished at: 2021-06-14T14:12:29+05:30
[INFO] -----------------------------------------
Steps I followed.
gpg
using brew. gpg (GnuPG) 2.3.1
libgcrypt 1.9.3
.m2
directory path - ~/.m2/settings.xml
settings.xml file
<settings>
<servers>
<server>
<id>ossrh</id>
<username>$name</username>
<password>$password</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>$passphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
I have imported the .asc
file using gpg --import file.asc
when I run gpg --list-keys
command, I'm able to see the pub
, uid
& sub
key values.
My current mvn version is Apache Maven 3.6.3
I have updated my project module pom.xml with the below values
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Can you please someone help what's wrong with my configuration? Why I am getting the no default secret key: No secret key
error?
I have referred this issue but still no luck
Upvotes: 2
Views: 1103
Reputation: 305
When I try to list the secrets it was not showing my secrets gpg --list-secret
.
Actually, When I try to list keys using gpg --list-keys
it was showing the values. I have assumed the ASC file is imported fine without any issue.
But actually, it's not imported the ASC file properly, I missed one step entering the password while importing the ASC file. I got to know by executing gpg --list-secret
command.
When you execute the gpg --list-secret
& gpg --list-keys
command it should show values then only the ASC file is imported correctly.
Upvotes: 2