Forum Discussion

Former Member's avatar
Former Member
4 years ago

SSH Commit Signing

I've stated signing my git commits using SSH.

However this only seems to work with setting the SSH_AUTH_SOCK env variable. For some reasons I cannot set that variable everywhere and have to rely on host specific IdentityAgent configuration.

This is the error
```
git commit -m"test"
error: Load key "/var/folders/z//T//.git_signing_key": invalid format?

fatal: failed to write commit object
```

Prepending the command with SSH_AUTH_SOCK=~/.1password/agent.sock git commit -m"test" works.

This issue also applies to VSCode.

As per the https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgltformatgtprogram, to used program is ssh-keygen. I guess it doesn't read ssh config files or at least wouldn't be aware of a host to use.

Question: Does 1Password provide a binary compatible to ssh-keygen that I could set as gpg.ssh.program in my gitconfig?


1Password Version: 8.7.3
Extension Version: Not Provided
OS Version: macOS
Browser:_ Not Provided

13 Replies

  • Former Member's avatar
    Former Member

    floris_1P Great to see your version of op-ssh-sign launch!

    One thing that seems a bit odd is when 1password is not started (or active)?

    It fails with this cryptic error message:

    ```
    āœ— git commit -m"test"
    error: Error: AppError { error: could not connect to agent

    Caused by:
    std::io::error::Error, location: Location { file: "ssh/op-ssh-sign/src/utils.rs", line: 27, col: 14 } }

    fatal: failed to write commit object
    ```

  • floris_1P's avatar
    floris_1P
    Icon for 1Password Team rank1Password Team

    We are looking into shipping something like that with the 1Password app. And what you're using now is exactly what I was about to suggest.

  • Former Member's avatar
    Former Member

    In the meantime I have created a gpg-ssh-program helper script myself:

    ```sh

    !/bin/sh

    SSH_AUTH_SOCK=~/.1password/agent.sock ssh-keygen "$@"
    ```

    And then as git config:
    config
    [gpg "ssh"]
    program = /Users/<username>/<path-to-script>/gpg-ssh-program