Skip to content

Instantly share code, notes, and snippets.

@IanoNjuguna
Last active December 1, 2022 15:28
Show Gist options
  • Save IanoNjuguna/2fef06d93f3d23114bcb54cfaaa1c00d to your computer and use it in GitHub Desktop.
Save IanoNjuguna/2fef06d93f3d23114bcb54cfaaa1c00d to your computer and use it in GitHub Desktop.
error: Couldn't load public key && "git"

Error Message

error: Couldn't load public key... : No such file or directory?

fatal: failed to write commit object

How I resolved it

First, I removed the format = ssh from my ~/.gitconfig file.

Second, I did some debugging by adding GIT_TRACE=1 at the beginning of the most recent git commit. In my case, it was:

GIT_TRACE=1 git commit -S -m "3-islower.c: Check for lowercase"

That enabled me to see what GPG is doing, and the log I needed was:

14:34:54.744990 run-command.c:668       trace: run_command: gpg --status-fd=2 -bsau 'my-GPG-key'

My GPG key was incorrect, and I solved that by Telling Git about my GPG Signing Key

My newfound experience enables me to point out that using SSH key to verify commits is a bad idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment