If you encounter a problem where you cannot commit your changes to git, you may be encountering a freeze during the commit process while it’s trying to sign your commit. This is often an issue with GPG being locked.
How it all started
Try another GPG operation
Ok. Now we have a clue, there is a lock held by [pid]
preventing the gpg database from opening. Let’s find out what the pid is.
Find the pid
Nothing other than our grep statement. It appears that this lock is being held by a pid that no long has an active process. Come to think of it, my mack did have a lockup this morning and I shut it down hard. I’m sure this is where this is leftover from.
Find a lock file containing our pid
Let’s break down what’s happening here…
Recursively find a file that matches [pid]
The location we want to search (~/
representing the home directory of the current user, .*
is to search in files and directories starting with a .
(AKA, hidden files and folders))
Send any errors to /dev/null
The findings
After executing the previous command, here’s what I found:
Get the lock file out of the way
You could rm -f
the file, but I prefer to move things out of the way to see what the outcome is before destruction.
Reload gpg agent
Validate the fix
Retry commit in git
Now that the gpg problem is resolved, go back and try commiting your changes, this should have resolved them!