How to gpgsign git commit using lazygit?
- Posted on
- Authors
- Name
- ansidev
- @ansidev
GPG sign git commit using lazygit.
Issue
One of best practices in my opinion when using git is enabling GPG signing for your commit.
And one of my favorite tools to commit my code in terminal environment is Lazygit. However, by default, it doesn’t work if GPG signing is enabled.
- https://github.com/jesseduffield/lazygit/issues/30
- https://github.com/jesseduffield/lazygit/issues/1146
Solution
After trying multiple solutions, I found a simple solution to resolve this issue.
You can add this config to your ssh config file (default path is ~/.ssh/config):
ForwardAgent yes
ForwardAgent yes
Note: You have to add config to the SSH key which will be used for signing the git commits.
After that, the config should look like below:
Host github
HostName github.com
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
Host github
HostName github.com
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
Hope this helps you out!