[ https://issues.apache.org/jira/browse/NETBEANS-3972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090997#comment-17090997 ]
Kevin Andrews commented on NETBEANS-3972: ----------------------------------------- [~geertjan] I've produced a successful implementation, which I'll pop up in a pull request to show the sample. However personally i'm not happy with the implementation. It involves detecting gpgsign = true in the current repo being committed at the GIT UI module level, requesting the GPG Private Key Passphrase from the user then providing this to the commit() Command via a construct parameter (which changes the signature and breaks most of the unit tests (this is the bit i'm not happy with)) the command can then provide the gpg private key Passphrase to jgit which then uses bouncycastle to perform the gpg key access and signing. Theoretically what would be a better way to provide this value from CommitAction.java through to CommitCommand.java? The experience is also a little jaring as when selecting git -> commit you then get prompted for the GPG Passphrase before entering the commit message, selecting files and setting author/committer, so a few improvements needed but this is definitely a proof of concept at least :) > Unable to git commit changes with GPG signing > --------------------------------------------- > > Key: NETBEANS-3972 > URL: https://issues.apache.org/jira/browse/NETBEANS-3972 > Project: NetBeans > Issue Type: Bug > Components: versioncontrol - Git > Affects Versions: 12.0, 11.3 > Reporter: Kevin Andrews > Priority: Minor > > After setting up git GPG key signing on the repo config: > {code:java} > [user] > name = XX > email = XX > signingkey = XXXXXX > [commit] > gpgsign = true{code} > I can commit in a terminal and commits are signed, however through NetBeans I > get the following error after entering a commit message and clicking commit: > {code:java} > <record> > <date>2020-03-06T21:35:15</date> > <millis>1583530515293</millis> > <sequence>21894</sequence> > <logger>org.netbeans.ui.focus</logger> > <level>500</level> > <thread>138</thread> > <message>LOG_WINDOW_ACTIVATED</message> > <key>LOG_WINDOW_ACTIVATED</key> > <catalog>org.netbeans.core.ui.warmup.Bundle</catalog> > <param>25</param> > </record> > <record> > <date>2020-03-06T21:35:17</date> > <millis>1583530517740</millis> > <sequence>21895</sequence> > <logger>org.netbeans.ui.actions</logger> > <level>400</level> > <thread>22</thread> > <message>UI_ACTION_BUTTON_PRESS</message> > <key>UI_ACTION_BUTTON_PRESS</key> > <catalog>org.openide.awt.Bundle</catalog> > <param>javax.swing.JMenuItem[Commit...]</param> > <param>javax.swing.JMenuItem</param> > > <param>org.netbeans.modules.versioning.util.SystemActionBridge[Commit...]</param> > <param>org.netbeans.modules.versioning.util.SystemActionBridge</param> > <param>Commit...</param> > </record> > <record> > <date>2020-03-06T21:35:17</date> > <millis>1583530517740</millis> > <sequence>21896</sequence> > <logger>org.netbeans.ui.SystemActionBridge</logger> > <level>400</level> > <thread>22</thread> > <message>UI_ACTION_BUTTON_PRESS</message> > <key>UI_ACTION_BUTTON_PRESS</key> > <catalog>org.openide.awt.Bundle</catalog> > <param></param> > <param></param> > > <param>org.netbeans.modules.git.ui.commit.CommitAction[Co&mmit...]</param> > <param>org.netbeans.modules.git.ui.commit.CommitAction</param> > <param>Co&mmit...</param> > </record> > <record> > <date>2020-03-06T21:35:19</date> > <millis>1583530519266</millis> > <sequence>21898</sequence> > <logger>org.netbeans.ui.vcs</logger> > <level>800</level> > <thread>138</thread> > <message>USG_VCS_CMD</message> > <key>USG_VCS_CMD</key> > <catalog>org.netbeans.modules.versioning.util.Bundle</catalog> > <param>GIT</param> > <param>11</param> > <param>0</param> > <param>commit</param> > <param>INTERNAL</param> > </record> > <record> > <date>2020-03-06T21:35:19</date> > <millis>1583530519266</millis> > <sequence>21899</sequence> > <logger>org.netbeans.modules.git</logger> > <level>800</level> > <thread>138</thread> > <message>org.eclipse.jgit.api.errors.JGitInternalException: missing > credentials provider</message> > <exception> > <message>org.netbeans.libs.git.GitException: > org.eclipse.jgit.api.errors.JGitInternalException: missing credentials > provider</message> > <frame> > <class>org.netbeans.libs.git.jgit.commands.CommitCommand</class> > <method>run</method> > <line>153</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <frame> > <class>org.netbeans.libs.git.jgit.commands.GitCommand$1</class> > <method>run</method> > <line>57</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <frame> > <class>org.netbeans.libs.git.jgit.commands.GitCommand$1</class> > <method>run</method> > <line>54</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <frame> > <class>java.security.AccessController</class> > <method>doPrivileged</method> > <file>jrt:/java.base/java/security/AccessController.class</file> > </frame> > <frame> > <class>org.netbeans.libs.git.jgit.commands.GitCommand</class> > <method>execute</method> > <line>54</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <frame> > <class>org.netbeans.libs.git.GitClient</class> > <method>commit</method> > <line>480</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient$9</class> > <method>call</method> > <line>297</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient$9</class> > <method>call</method> > <line>293</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > > <class>org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1</class> > <method>call</method> > <line>933</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > > <class>org.netbeans.modules.git.client.GitClient$CommandInvoker$1</class> > <method>call</method> > <line>956</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.FilesystemInterceptor</class> > <method>runWithoutExternalEvents</method> > <line>473</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.Git</class> > <method>runWithoutExternalEvents</method> > <line>259</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient$CommandInvoker</class> > <method>runMethodIntern</method> > <line>966</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient$CommandInvoker</class> > <method>runMethod</method> > <line>893</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient$CommandInvoker</class> > <method>access$300</method> > <line>869</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitClient</class> > <method>commit</method> > <line>293</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > > <class>org.netbeans.modules.git.ui.commit.CommitAction$CommitProgressSupport</class> > <method>commit</method> > <line>342</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > > <class>org.netbeans.modules.git.ui.commit.CommitAction$CommitProgressSupport</class> > <method>perform</method> > <line>233</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitProgressSupport</class> > <method>performIntern</method> > <line>92</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.git.client.GitProgressSupport</class> > <method>run</method> > <line>85</line> > <file>${netBeansDir}modules/org-netbeans-modules-git.jar</file> > </frame> > <frame> > <class>org.openide.util.RequestProcessor$Task</class> > <method>run</method> > <line>1418</line> > <file>${netbeans.home}lib/org-openide-util.jar</file> > </frame> > <frame> > <class>org.netbeans.modules.openide.util.GlobalLookup</class> > <method>execute</method> > <line>45</line> > <file>${netbeans.home}lib/org-openide-util-lookup.jar</file> > </frame> > <frame> > <class>org.openide.util.lookup.Lookups</class> > <method>executeWith</method> > <line>278</line> > <file>${netbeans.home}lib/org-openide-util-lookup.jar</file> > </frame> > <frame> > <class>org.openide.util.RequestProcessor$Processor</class> > <method>run</method> > <line>2033</line> > <file>${netbeans.home}lib/org-openide-util.jar</file> > </frame> > </exception> > <exception> > <message>org.eclipse.jgit.api.errors.JGitInternalException: missing > credentials provider</message> > <frame> > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner</class> > <method>sign</method> > <line>162</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.class</file> > </frame> > <frame> > <class>org.eclipse.jgit.api.CommitCommand</class> > <method>call</method> > <line>271</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/api/CommitCommand.class</file> > </frame> > <frame> > <class>org.netbeans.libs.git.jgit.commands.CommitCommand</class> > <method>run</method> > <line>138</line> > <file>${netBeansDir}modules/org-netbeans-libs-git.jar</file> > </frame> > <more>23</more> > </exception> > <exception> > <message>org.bouncycastle.openpgp.PGPException: missing credentials > provider</message> > <frame> > > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyPassphrasePrompt</class> > <method>getPassphrase</method> > <line>120</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyPassphrasePrompt.class</file> > </frame> > <frame> > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator</class> > <method>findSecretKeyForKeyBoxPublicKey</method> > <line>395</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.class</file> > </frame> > <frame> > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator</class> > <method>findSecretKey</method> > <line>292</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.class</file> > </frame> > <frame> > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner</class> > <method>locateSigningKey</method> > <line>124</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.class</file> > </frame> > <frame> > <class>org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner</class> > <method>sign</method> > <line>133</line> > > <file>bundleresource://139.fwk454866309/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.class</file> > </frame> > <more>25</more> > </exception> > </record> > ==> .netbeans/11.3/var/log/messages.log <== > WARNING [org.netbeans.modules.progress.spi.InternalHandle]: Cannot call > progress on a task that was never started at > org.netbeans.modules.git.client.GitProgressSupport.setProgressMessage(GitProgressSupport.java:258) > INFO [org.netbeans.modules.git]: > org.eclipse.jgit.api.errors.JGitInternalException: missing credentials > provider > org.bouncycastle.openpgp.PGPException: missing credentials provider > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyPassphrasePrompt.getPassphrase(BouncyCastleGpgKeyPassphrasePrompt.java:120) > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKeyForKeyBoxPublicKey(BouncyCastleGpgKeyLocator.java:395) > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgKeyLocator.findSecretKey(BouncyCastleGpgKeyLocator.java:292) > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.locateSigningKey(BouncyCastleGpgSigner.java:124) > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.sign(BouncyCastleGpgSigner.java:133) > Caused: org.eclipse.jgit.api.errors.JGitInternalException: missing > credentials provider > at > org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner.sign(BouncyCastleGpgSigner.java:162) > at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:271) > at > org.netbeans.libs.git.jgit.commands.CommitCommand.run(CommitCommand.java:138) > Caused: org.netbeans.libs.git.GitException > at > org.netbeans.libs.git.jgit.commands.CommitCommand.run(CommitCommand.java:153) > at > org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:57) > at > org.netbeans.libs.git.jgit.commands.GitCommand$1.run(GitCommand.java:54) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at > org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:54) > at org.netbeans.libs.git.GitClient.commit(GitClient.java:480) > at org.netbeans.modules.git.client.GitClient$9.call(GitClient.java:297) > at org.netbeans.modules.git.client.GitClient$9.call(GitClient.java:293) > at > org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:933) > at > org.netbeans.modules.git.client.GitClient$CommandInvoker$1.call(GitClient.java:956) > at > org.netbeans.modules.git.FilesystemInterceptor.runWithoutExternalEvents(FilesystemInterceptor.java:473) > at org.netbeans.modules.git.Git.runWithoutExternalEvents(Git.java:259) > at > org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethodIntern(GitClient.java:966) > at > org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:893) > at > org.netbeans.modules.git.client.GitClient$CommandInvoker.access$300(GitClient.java:869) > at org.netbeans.modules.git.client.GitClient.commit(GitClient.java:293) > at > org.netbeans.modules.git.ui.commit.CommitAction$CommitProgressSupport.commit(CommitAction.java:342) > [catch] at > org.netbeans.modules.git.ui.commit.CommitAction$CommitProgressSupport.perform(CommitAction.java:233) > at > org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:92) > at > org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:85) > at > org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) > at > org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) > at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) > at > org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) > {code} > Happy to help test, just let me know what to do. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists