Unable to sign GitHub commit from Eclipse

137 Views Asked by At

I am trying to sign my commits, from Eclipse IDE, using GPG (as implemented by Git). I have generated the keys, updated the necessary configuration, bot on my computer and GitHub, but I can not get the process to work. Keep in mind that the commit process works ok from eclipse, as long as I do not enable signing (no problem with github setup).

If I enable the signing, in Eclipse, the process starts, it asks me for the password for the key but after that I get an error (showed in Eclipse details):

An internal error occurred
External program failed ([GNUPG:] KEY_CONSIDERED 9AFFDDDAA380771D16313B11B08D503E442EBB5C 2
[GNUPG:] BEGIN_SIGNING H8
[GNUPG:] PINENTRY_LAUNCHED 1828 w32 1.2.1-unknown - xterm-256color - - 197609/197609 0
[GNUPG:] SIG_CREATED D 1 8 00 1700211085 9AFFDDDAA380771D16313B11B08D503E442EBB5C
): C:\Program Files\Git\usr\bin\gpg.exe -bsau B08D503E442EBB5C --batch --no-tty --status-fd 2 --output -

If I run the command C:\Program Files\Git\usr\bin\gpg.exe -bsau B08D503E442EBB5C --batch --no-tty --status-fd 2 --output - straight into GitBash, is it working ok, as I get the following output

cosmi@Terra MINGW64 ~
$ "C:\Program Files\Git\usr\bin\gpg.exe" -bsau B08D503E442EBB5C --batch --no-tty --status-fd 2 --output -
[GNUPG:] KEY_CONSIDERED 9AFFDDDAA380771D16313B11B08D503E442EBB5C 2
[GNUPG:] BEGIN_SIGNING H8
this is the content that will be signed
another row
[GNUPG:] SIG_CREATED D 1 8 00 1700211486 9AFFDDDAA380771D16313B11B08D503E442EBB5C
-----BEGIN PGP SIGNATURE-----

iQGzBAABCAAdFiEEmv/d2qOAdx0WMTsRsI1QPkQuu1wFAmVXKx4ACgkQsI1QPkQu
u1yg5Av/cgJ4iSCixooyMLPoXfc9jXwfootSjKQh4/YuFCswwZq6pOThCV2WaPUt
Mr53QyHfF2ZHlKILZMSXZ2RQPLtZ42oDMG7Ly6P62gfJVLwkwMjao4WW5ySDUr75
MzYWLHxBeWhGgR0l+rrJ+0Y+W9fJ94T6rg6XZ2tkkcjFUy5rrhoYuFSrGkmfSVwZ
p8DYVGH7VflLXImNZsEUXqvH1hOLLerDgKSx4shXlrU6ASZlNToOdY1F8vOCNwqO
EWiXcee+Z2o0iYTwwYa+hlndNYUHHUtO8zg9MbsMLS0I5Kh9FotuiId9MuSYne92
DLka4op32BGExUPy0UpM+lgQSvE0CFm/TbJisp3E0X8+bs2RNZ67BtzKfNwGSWlZ
nI41+hbnZr3YM4IZpt4sczcgB7kG2CQIrFWqbAOBrcvHjQI7HrEH2KystZBtyvtt
C+n/Dd2C8emWyLIy56ps30RZKU5HOmXwtqA+crPAqWcLepGqwimFk0oi+dqL/zYv
5NBOZdaN
=wi4U
-----END PGP SIGNATURE-----

cosmi@Terra MINGW64 ~

What I tried so far:

  • read a lot of data about Eclipse and signing, found nothing about this particular case
  • is does not matter if git is using mingw64 or windows terminal
  • it does not matter if I am using Git or Gpg4win
  • it does not matter what algorithm I am using for the key (right now I am using RSA)

What am I suspecting: The Git/GPG installation is ok, there is a problem with the way Eclipse is reading the output from gpg.exe.

Any help will be appreciated.

LE

After mode digging, I can see that the key is generared, but Eclipse says that is it invalid. Below is the error log from Eclipse.

org.eclipse.jgit.api.errors.JGitInternalException: External program failed ([GNUPG:] KEY_CONSIDERED 9AFFDDDAA380771D16313B11B08D503E442EBB5C 2
[GNUPG:] BEGIN_SIGNING H8
[GNUPG:] PINENTRY_LAUNCHED 541 w32 1.2.1-unknown - xterm-256color - - 197609/197609 0
[GNUPG:] SIG_CREATED D 1 8 00 1704551695 9AFFDDDAA380771D16313B11B08D503E442EBB5C
): C:\Program Files\Git\usr\bin\gpg.exe -bsau <<hidden>@<hidden>.com> --batch --no-tty --status-fd 2 --output -
    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.signObject(ExternalGpgSigner.java:191)
    at org.eclipse.jgit.api.CommitCommand.sign(CommitCommand.java:336)
    at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:283)
    at org.eclipse.egit.core.op.CommitOperation.commit(CommitOperation.java:259)
    at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:211)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2453)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2478)
    at org.eclipse.egit.core.op.CommitOperation.execute(CommitOperation.java:220)
    at org.eclipse.egit.ui.internal.commit.CommitJob.run(CommitJob.java:135)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.io.IOException: External program failed ([GNUPG:] KEY_CONSIDERED 9AFFDDDAA380771D16313B11B08D503E442EBB5C 2
[GNUPG:] BEGIN_SIGNING H8
[GNUPG:] PINENTRY_LAUNCHED 541 w32 1.2.1-unknown - xterm-256color - - 197609/197609 0
[GNUPG:] SIG_CREATED D 1 8 00 1704551695 9AFFDDDAA380771D16313B11B08D503E442EBB5C
): C:\Program Files\Git\usr\bin\gpg.exe -bsau <<hidden>@<hidden>> --batch --no-tty --status-fd 2 --output -
    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.runProcess(ExternalGpgSigner.java:135)
    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.signWithGpg(ExternalGpgSigner.java:297)
    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.signObject(ExternalGpgSigner.java:189)
    ... 9 more
Caused by: java.io.IOException: External GPG did not return a valid signature; got: -----BEGIN PGP SIGNATURE-----

iQHLBAABCAA1FiEEmv/d2qOAdx0WMTsRsI1QPkQuu1wFAmWZZQ8XHGNvc21pbnN0
YWljdUBnbWFpbC5jb20ACgkQsI1QPkQuu1wYVAwAko5/T/oip+ix1wufJFmJVST3
FtT3Z2J1Oai5i18RYCWtTIShAKLZ6UlN9tOjTw8fcz0ljTvWnfojWW4zyz80ztCL
zn8n1nSWZmrwC0xv28QogL6sV7oRkln3+zqh49wavw3afIucicaGcSHhUG+vkPtt
zC7JscyGlDaJjg5wFGV3/AEfwf4u5JN1bZCecrxGvjVySjpRl5YHAEP/bJv4MGA3
6i2Deny//j6l4ht2o1eKEHlxxWay1We0YTGOiR50zKni5EAu2zddQ8Wbh15iGGbO
+EMdD3mii+dILDMRgTedDRBeHhaY+QWyiwRnIfQ1ifsIsJvwVPYNlIHUs4Wil5y1
I2bh4cZzzHZweq8CWh8ZYwkzEikXrNAW23k6xVOnIFBsJ5c8HudF4Ml5CY4sS9LL
g14Jd1+hgX96q4oK9dgv5mvHkWXAOj/E6cDVSJO/iZCEe7HjRw/DbfE636GvIfMg
qGDb2Hh5rVfXf7cZa2JbBXacpBh2Ics5ik4BkrsW
=DIGl
-----END PGP SIGNATURE-----

    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.lambda$1(ExternalGpgSigner.java:326)
    at org.eclipse.egit.core.internal.signing.ExternalGpgSigner.runProcess(ExternalGpgSigner.java:110)
    ... 11 more

As you can see, it says

Caused by: java.io.IOException: External GPG did not return a valid signature; got: -----BEGIN PGP SIGNATURE-----

No ideea how to move further.

0

There are 0 best solutions below