Skip to content

Instantly share code, notes, and snippets.

@diogow3
Last active November 5, 2024 18:49
Show Gist options
  • Select an option

  • Save diogow3/e64b25ab084247c7425e8d930c274bf9 to your computer and use it in GitHub Desktop.

Select an option

Save diogow3/e64b25ab084247c7425e8d930c274bf9 to your computer and use it in GitHub Desktop.
SSH key for Authentication and Signing commits

SSH key for Authentication and Signing commits

Generate a SSH key

ssh-keygen -t ed25519 -C "your_email@example.com"

If you are on Windows, do not rename the file

Enter file in which to save the key (~/.ssh/id_ed25519):

Give it a password

Start the agent

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Add the SSH key to your Github/Gitlab account

Linux

cat ~/.ssh/id_ed25519.pub

Windows

clip < ~/.ssh/id_ed25519.pub

Copy the contents of the .pub file displayed in the terminal to your clipboard

Paste the contents into your account -> settings -> ssh keys

Test your connection

ssh -T git@github.com

Configure Git to sign commits with your SSH key

git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true

Set VS Code

  • preferences > settings > gpg > enable commit signing with gpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment