jesseduffield / lazygit

simple terminal UI for git commands
MIT License
51.69k stars 1.81k forks source link

[Resolved] [GPG] error: gpg failed to sign the data #3959

Open mathys-lopinto opened 6 days ago

mathys-lopinto commented 6 days ago

Describe the bug When i try to commit with my gpg key (i force) I have an error:


+ git commit -m My Commit Title

error: gpg failed to sign the data
fatal: failed to write commit object

Press enter to return to lazygit

OS: Neon 22.04 jammy Shell: bash 5.1.16 DE: KDE WM: KWin

To Reproduce Steps to reproduce the behavior:

  1. Run command gpg --full-generate-key to generate the GPG key and setup an password to the gpg key
  2. Configure git to sign commit: git config --global commit.gpgsign true
  3. Configure the key to sign git config --global user.signingkey <key id>
  4. Run lazygit and try to commit

Expected behavior Lazygit ask my gpg password and the i have an commit

Screenshots image

Version info: Lazygit version: commit=611fabde11d24d9acc71ee26077b9a1101f59f27, build date=2024-09-18T10:56:10Z, build source=binaryRelease, version=0.44.1, os=linux, arch=amd64, git version=2.34.1 Git version: git version 2.34.1

scorreanu commented 1 day ago

Can you try adding the -S to the command, It should look like `git commit -S -m "your fancy message"

Other posible solutions:

  1. There is a signOff key in the config that can set to true (config)
  2. Sometimes I have to export an env variable so I run export GPG_TTY=$(tty)
mathys-lopinto commented 11 hours ago

Hey, Run export GPG_TTY=$(tty) before run lazygit working.