Solution to the gpg problem on github desktop?

  Kiến thức lập trình

I have been seeing several users have problems signing with github dektop, I had these two errors

gpg: error running '/usr/lib/gnupg/keyboxd': probably not installed
gpg: failed to start keyboxd '/usr/lib/gnupg/keyboxd': Configuration error
gpg: can't connect to the keyboxd: Configuration error
gpg: error opening key DB: No Keybox daemon running
gpg: skipped "your key": Input/output error
gpg: signing failed: Input/output error
error: gpg failed to sign the data
fatal: failed to write commit object

or

gpg: skipped "your key": Input/output error
gpg: signing failed: Input/output error
error: gpg failed to sign the data
fatal: failed to write commit object

The version of gpg I have is 2.4.4 and the version of github desktop is 3.4.1

So I was looking for a solution to this problem, and I found a series of steps that managed to solve this problem, it should be noted that I use Windows 11

First of all you must have everything configured correctly, and if you still have these problems you can try this method

[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true
[user]
    name = user
    email = [email protected]
    signingkey = your key
[log]
    showSignature = true
[commit]
    gpsign = true
    gpgsign = true
[gpg]
    program = C:/Program Files/Git/usr/bin/gpg
[tag]
    gpgsign = true

When I turn on my laptop this is the configuration I always have. I read in a publication that git has its own gpg and the path that is there is not the “correct” one if it should not be the path in which we install the gpg. Later I will explain this in detail and why I put correct in quotes.

The first thing I did was write these two lines in gpg-agent.conf:

enable-ssh-support
allow-loopback-pinentry

Then in gpg.conf I have the following lines:

no-tty
use-agent
pinentry-mode loopbackno-tyy
no-tty

The line: pinentry-mode loopbackno-tyy then it will affect but don’t worry, it will be normal for the process that I follow

After this, the first line I executed in the git bash terminal was the following:

git config --global gpg.program "C:Program Files (x86)GnuPGbingpg.exe"

As I mentioned before, I had read in a publication that git has its default route for gpg, but when installing it another route is also created, in case this is not your route from where git is installed, you will have to look for where it is located

After this, I wrote the following line:

gpg --versión

Just to know the gpg version, now:

echo "test" | gpg --clearsign

When you rewrite the line and have commented on the pinentry-mode, a window should load and appear to write your password, which you chose when creating the key.

You must enter your password and a text similar to when the key is exported to be added to Github will be generated.

Then you will write the following:

export GPG_TTY=$(tty)

Nothing will happen, then you will write the following line again:

echo "test" | gpg --clearsign

T
his time it won’t ask you for a password, it will just show you all the text again

Now, you will write the following:

git config -l | grep gpg

It will show you some lines like this:

commit.gpgsign=true
gpg.program=C:/Program Files/Git/usr/bin/gpg
tag.gpgsign=true

And finally you will write the following:

git config --global gpg.program "$(which gpg)"

This is what it will do is put the gpg location back as it was at the beginning, that is, with the git location, that’s why I mentioned “correct” in quotes, because by doing all this you clean your key so that github dektop believes it to be the correct location, or is it something how I would explain it. After this you can write your commit and push it.

I hope it has been useful to you!

New contributor

Eduardo Castro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT