Last active
November 7, 2025 17:25
-
Star
(352)
You must be signed in to star a gist -
Fork
(38)
You must be signed in to fork a gist
-
-
Save paolocarrasco/18ca8fe6e63490ae1be23e84a7039374 to your computer and use it in GitHub Desktop.
Revisions
-
paolocarrasco revised this gist
Nov 6, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,12 +53,13 @@ It means that is not finding the key that was set. You would need to set up the ``` 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. A specific and [popular solution](https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=4726796#gistcomment-4726796) posted for mac users by @lehaiquantb suggests to install `pinentry` (I'm not a fan of installing stuff but if you are ok with it): ```shell brew install pinentry-mac echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf killall gpg-agent ``` 5. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). Hope it helps! -
paolocarrasco revised this gist
Nov 6, 2025 . 1 changed file with 18 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,37 +1,42 @@ Problem ------- You have installed GPG, then tried to perform a `git commit` and suddenly you see this error message after it 😰 ``` error: gpg failed to sign the data fatal: failed to write commit object ``` Understand the error (important to solve it later!) ---------------------------------------------------- To understand what's going on, first check what git is doing, so add `GIT_TRACE=1` at the beginning of the command you used before (`git commit` or `git rebase` or `git merge` or anything like that): ``` GIT_TRACE=1 git commit ``` With that you can see what GPG is doing. You will see something like this: ``` 10:37:22.346480 run-command.c:637 trace: run_command: gpg --status-fd=2 -bsau <your GPG key> ``` (First thing would be to check if your GPG key is correct) Execute that gpg command again in the command line: ``` gpg --status-fd=2 -bsau <your GPG key> ``` 👆🏻 Executing this will give you a useful output that will allow you to see what happened in detail 🙌🏼 Check now the possible solutions based on your findings 👀 Some solutions -------------- We can have many problems, but I list what I found and some solutions posted in the thread: 1. It could be that the *GPG key was expired*: https://stackoverflow.com/a/47561300/532912 1. Another thing could be that *the secret key was not set properly* (In my case the message said `gpg: signing failed: No secret key` as it can be see in the image below). @@ -49,8 +54,8 @@ It means that is not finding the key that was set. You would need to set up the 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). 1. A specific and [popular solution](https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=4726796#gistcomment-4726796) posted for mac users by @lehaiquantb suggests to install `pinentry` (I'm not a fan of installing stuff but if you are ok with it): ```shell brew install pinentry-mac echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf killall gpg-agent -
paolocarrasco revised this gist
Nov 6, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,7 +49,7 @@ It means that is not finding the key that was set. You would need to set up the 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). 2. A specific and [popular solution](https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=4726796#gistcomment-4726796) posted for mac users by @lehaiquantb suggests to install `pinentry` (I'm not a fan of installing stuff but if you are ok with it): ``` brew install pinentry-mac echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf -
paolocarrasco revised this gist
Nov 6, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,7 +49,7 @@ It means that is not finding the key that was set. You would need to set up the 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). 2. A specific and [popular solution](https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=4726796#gistcomment-4726796) posted for mac users by @lehaiquantb suggests to install `pinentry` (I'm not a fan of installing stuff but if you want): ``` brew install pinentry-mac echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf -
paolocarrasco revised this gist
Nov 6, 2025 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,5 +49,11 @@ It means that is not finding the key that was set. You would need to set up the 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). 2. A specific and popular solution posted for mac users: ``` brew install pinentry-mac echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf killall gpg-agent ``` Hope it helps! -
paolocarrasco revised this gist
Aug 3, 2023 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,6 +46,8 @@ It means that is not finding the key that was set. You would need to set up the ```shell git config --global user.signingkey <your key> ``` 1. Another popular solution that could help was shared here by [@NirajanMahara](https://github.com/NirajanMahara): https://gist.github.com/paolocarrasco/18ca8fe6e63490ae1be23e84a7039374?permalink_comment_id=3767413#gistcomment-3767413 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). Hope it helps! -
paolocarrasco revised this gist
Sep 24, 2021 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,15 +37,15 @@ We can have many problems, but I list what I found: 1. Another thing could be that *the secret key was not set properly* (In my case the message said `gpg: signing failed: No secret key` as it can be see in the image below).  It means that is not finding the key that was set. You would need to set up the GPG key in Git (again): - List the secret keys available in GPG. ```shell gpg --list-secret-keys --keyid-format=long ``` - Copy your key - Set your key for your user in git ```shell git config --global user.signingkey <your key> ``` 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). Hope it helps! -
paolocarrasco revised this gist
Sep 24, 2021 . 1 changed file with 14 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ For understanding what's going on, first check what git is doing, so add `GIT_TR GIT_TRACE=1 git commit ``` With that you can see what GPG is doing: Probably you will see something like this ``` 10:37:22.346480 run-command.c:637 trace: run_command: gpg --status-fd=2 -bsau <your GPG key> @@ -26,18 +26,26 @@ Execute that gpg command again in the command line: ``` gpg --status-fd=2 -bsau <your GPG key> ``` 👆🏻 With this now you could see what happened in detail! Solutions --------- We can have many problems, but I list what I found: 1. It could be that the *GPG key was expired*: https://stackoverflow.com/a/47561300/532912 1. Another thing could be that *the secret key was not set properly* (In my case the message said `gpg: signing failed: No secret key` as it can be see in the image below).  It means that is not finding the key that was set. You would need to set up the GPG key in Git (again): 1. List the secret keys available in GPG. ```shell gpg --list-secret-keys --keyid-format=long ``` 1. Copy your key 1. Set your key for your user in git ```shell git config --global user.signingkey <your key> ``` 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). Hope it helps! -
paolocarrasco revised this gist
Sep 24, 2021 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,18 +22,22 @@ Probably you will see something like this ``` (Check if your GPG key is correct) Execute that gpg command again in the command line: ``` gpg --status-fd=2 -bsau <your GPG key> ``` Now you could see what happened in detail! Solutions --------- We can have many problems, but I list what I found: 1. It could be that the GPG key was expired: https://stackoverflow.com/a/47561300/532912 1. Another thing could be that the secret key was not set (In my case the message said `gpg: signing failed: No secret key` as it can be see in the image below).  It means that is not finding the key that was set. 1. You can see in the thread of this gist other ways to find the solution to other problems. I recommend to read the [Github guide for signing commits with GPG](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key). Hope it helps! -
paolocarrasco revised this gist
Sep 24, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,9 @@ fatal: failed to write commit object Debug ----- For understanding what's going on, first check what git is doing, so add `GIT_TRACE=1` at the beginning of the command you used before (`git commit` or `git rebase`): ``` GIT_TRACE=1 git commit ``` With that you can see what the problem can be. And what GPG is doing: -
paolocarrasco created this gist
Aug 29, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ Problem ------- You have installed GPG, then tried to commit and suddenly you see this error message after it: ``` error: gpg failed to sign the data fatal: failed to write commit object ``` Debug ----- For understanding what's going on, first check what git is doing: ``` GIT_TRACE=1 git rebase --continue ``` With that you can see what the problem can be. And what GPG is doing: Probably you will see something like this ``` 10:37:22.346480 run-command.c:637 trace: run_command: gpg --status-fd=2 -bsau <your GPG key> ``` (Check if your GPG key is correct) Repeat that gpg command again in the command line: ``` gpg --status-fd=2 -bsau <your GPG key> ``` Solutions --------- We can have many problems, but I list what I found: 1. It could be that the GPG key was expired: https://stackoverflow.com/a/47561300/532912 1. Another thing could be that the secret key was not set (the message says `gpg: signing failed: No secret key`). It means that is not finding the key that was set (it happened to me because I preppended a number). Hope it helps!