Skip to main content
hammadmajid
May 5, 2023
Question

Signing Git commit fails with "error: agent returned an error"

  • May 5, 2023
  • 6 replies
  • 5344 views

I followed this https://developer.1password.com/docs/ssh/git-commit-signing step by step on how to sign Git commits with SSH.

When I commit, 1Password shows a pop-up for approval as expected but after I authorize, commit sign fails with:

```
error: agent returned an error

fatal: failed to write commit object
```

My .gitconfig


[core]
editor = nvim
autocrlf = false
sshCommand = C:\\Windows\\System32\\OpenSSH\\ssh.exe
[credential "https://github.com"]
helper =
helper = !'C:\\Users\\hamma\\scoop\\apps\\gh\\current\\bin\\gh.exe' auth git-credential
[credential "https://gist.github.com"]
helper =
helper = !'C:\\Users\\hamma\\scoop\\apps\\gh\\current\\bin\\gh.exe' auth git-credential
[gpg]
format = ssh
[gpg "ssh"]
program = C:\\Users\\hamma\\AppData\\Local\\1Password\\app\\8\\op-ssh-sign.exe
[commit]
gpgsign = true
[user]
signingkey = ssh-ed25519 AAA********************************************TC
email = *******************
name = Hammad

6 replies

May 5, 2023

I'm seeing the same error message after following the guide. I'm on Mac.

I can reproduce the error by copying my ssh public key to a file, creating a file to sign and calling the command line. This pops up the dialog to unlock my key, but after using my fingerprint, the command returns the error message.


/Applications/1Password.app/Contents/MacOS/op-ssh-sign -U -Y sign -n git -f pub-key -- pay
agent returned an error

May 5, 2023

When I try running my test command I see this in the 1Password log file:


ERROR 2023-05-05T22:00:32.022 tokio-runtime-worker(ThreadId(4)) [1P:ssh/op-ssh-agent/src/lib.rs:583] SSH authorization model was set incorrectly, dropping signature request

May 5, 2023

Searching for that error brought me to the following suggestion. Twiddling this part of the 1Password preferences fixed it for me.

Could you open the 1Password app and navigate to Settings -> Developer -> SSH Agent -> Security and change the "Ask approval for each new..." setting to some other value and then change it back to the setting you prefer?

This should fix your issue. We're currently working on a fix that should prevent this from happening in the future.

See this thread: https://1password.community/discussion/139580/why-are-my-ssh-attempts-failing

hammadmajid
May 6, 2023

Changing the Ask approval for each new option fixed the issue.

Thanks ♥

CharDSon
May 6, 2023

After much testing and research I came up with this solution, thank you very much.

May 26, 2023

Glad to hear you managed to resolve the issue. Sorry for the inconvenience!