DEV Community

David Lun
David Lun

Posted on β€’ Originally published at davidlun.com

1

How to configure 1Password SSH Key and automatically sign your commits on GitHub?

  • First generate ssh key using 1Password and save it in Vault. Optionally you can add your existing keys manually.

  • On 1Password Settings -> Developer check Use the SSH agent box.

  • Create allowed-signers file, Sublime Merge complains if it can't find this file and shows all commits as invalid.

mkdir -p /home/$(whoami)/config/git/
touch /home/$(whoami)/config/git/allowed-signers
Enter fullscreen mode Exit fullscreen mode
  • Update your local git configuration ~/.gitconfig
[gpg]
    format = ssh
[gpg "ssh"]
    program = /opt/1Password/op-ssh-sign
    allowedSignersFile = /home/user/config/git/allowed-signers
[commit]
    gpgsign = true
[user]
    signingKey = ssh-ed25519 pubkey
    name = Your name
    email = email@example.org
[init]
    defaultBranch = main
Enter fullscreen mode Exit fullscreen mode
  • Update local SSH configuration to use 1Password's SSH agent for all hosts ~/.ssh/config
Host *
        IdentityAgent ~/.1password/agent.sock
Enter fullscreen mode Exit fullscreen mode
  • Finally Add your public key to your GitHub account Settings -> SSH and GPG keys -> Signing keys

1Password will pop-up to authorize the use of your private key and if you generated your private key in the app it is never saved on the computer.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay