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

Options
hammadmajid
hammadmajid
Community Member

I followed this guide 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 

Comments

  • seth1cwave
    seth1cwave
    Community Member
    Options

    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
    
  • seth1cwave
    seth1cwave
    Community Member
    Options

    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
    
  • seth1cwave
    seth1cwave
    Community Member
    Options

    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
    hammadmajid
    Community Member
    Options

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

    Thanks ♥

  • CharDSon
    CharDSon
    Community Member
    Options

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

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

This discussion has been closed.