Skip to main content
March 20, 2023
Question

Signing git commits fails

  • March 20, 2023
  • 2 replies
  • 1483 views

I have set up 1Password to be my SSH agent. I've followed this guide to also sign my commits with my SSH instead of my GPG key. However, I get:
```
$ git commit -m "chore: evaluate up to order 32"
error: agent returned an error

fatal: failed to write commit object

Re-running the command with `GIT_TRACE=1` gives some more detail:

$ GIT_TRACE=1 git commit -m "chore: evaluate up to order 32"
07:56:10.865206 git.c:460 trace: built-in: git commit -m 'chore: evaluate up to order 32'
07:56:10.866144 run-command.c:1523 run_processes_parallel: preparing to run up to 1 tasks
07:56:10.866160 run-command.c:655 trace: run_command: GIT_EDITOR=: GIT_INDEX_FILE=.git/index .git/hooks/pre-commit
07:56:10.872238 git.c:750 trace: exec: git-annex pre-commit .
07:56:10.872280 run-command.c:655 trace: run_command: git-annex pre-commit .
07:56:10.882417 git.c:460 trace: built-in: git config --null --list
07:56:10.885478 git.c:460 trace: built-in: git symbolic-ref -q HEAD
07:56:10.887756 git.c:460 trace: built-in: git show-ref refs/heads/main
07:56:10.890362 git.c:460 trace: built-in: git diff --cached --name-only -z --diff-filter=ACMRT -- .
07:56:10.893499 git.c:460 trace: built-in: git symbolic-ref -q HEAD
07:56:10.895796 git.c:460 trace: built-in: git show-ref refs/heads/main
07:56:10.900968 run-command.c:1551 run_processes_parallel: done
07:56:10.901897 run-command.c:655 trace: run_command: /nix/store/60nj3ab2lcvw1pfm49dywmr922mk1kxk-1password-8.10.0/share/1password/op-ssh-sign -Y sign -n git -f /tmp/.git_signing_key_tmpMnv6pa /tmp/.git_signing_buffer_tmpiSuthd
error: agent returned an error

fatal: failed to write commit object

I've followed the troubleshooting instructions in the linked article and everything looks like it should, _i.e._ I don't have local overrides of the signing options. This is how the relevant parts of my Git configuration (stored in `.config/git/config`) looks like:

[gpg]
format = "ssh"

[gpg "ssh"]
program = "/nix/store/60nj3ab2lcvw1pfm49dywmr922mk1kxk-1password-8.10.0/share/1password/op-ssh-sign"

[commit]
gpgSign = true

[tag]
gpgSign = true

[user]
signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIODV5S21+jV0900ubPoYvdHol/xfbJjVhxayuMEFuPKo"
```
I'm running on NixOS and this file is generated by home-manager.


1Password Version: 8.10.0
Extension Version: 2.8.1
OS Version: NixOS 23.05.20230317.b573a7f
Browser:_ Brave

2 replies

March 21, 2023

It seems it was actually an issue with system authentication not being correctly integrated. After doing what suggested here: https://1password.community/discussion/comment/634787/#Comment_634787 I'm able to sign with the SSH key managed by the 1Password agent!

Jack_P_1P
1Password Employee
1Password Employee
March 24, 2023

Hi @robertodr:

Glad to hear you were able to get it sorted, and I'd like to apologize for the delay in getting to you. Please get in touch if there's anything else we can help you with.

Jack