Skip to content

Instantly share code, notes, and snippets.

@MathiasReker
Created September 10, 2022 10:34
Show Gist options
  • Select an option

  • Save MathiasReker/c891b5bcb497209a279b8a524e95f2d0 to your computer and use it in GitHub Desktop.

Select an option

Save MathiasReker/c891b5bcb497209a279b8a524e95f2d0 to your computer and use it in GitHub Desktop.

Revisions

  1. MathiasReker created this gist Sep 10, 2022.
    23 changes: 23 additions & 0 deletions ssh_signing_key.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash

    # Name of SSH key
    key=github_ed25519 # You can rename this

    # Generate new SSH key
    ssh-keygen -t ed25519 -f ~/.ssh/${key} -q -P ""

    # Authorized it
    cat ~/.ssh/${key}.pub >>~/.ssh/authorized_keys

    # Configure ~/.gitconfig
    git config --global user.signingkey "~/.ssh/${key}.pub"
    git config --global gpg.format "ssh"
    git config --global commit.gpgsign "true"

    # Get SSH key
    echo "! First copy your ssh-key:"
    cat ~/.ssh/$key.pub #| clip

    # Add new signing key on GitHub
    echo "Open this URL to continue in your web browser: https://github.com/settings/keys"
    echo "Create new SSH key. The key type must be signing key."