Skip to content

Instantly share code, notes, and snippets.

@CodeSigils
Created April 24, 2022 15:27
Show Gist options
  • Save CodeSigils/9f853a0c4e018c47b73ce8187f7530fc to your computer and use it in GitHub Desktop.
Save CodeSigils/9f853a0c4e018c47b73ce8187f7530fc to your computer and use it in GitHub Desktop.
Basic ed25519 SSH with keychain setup
#!/usr/bin/env bash
#
# DESC: Setup personal github account
#
## Define github user email
email='[email protected]'
## Generate SSH key pairs
ssh-keygen -t ed25519 -C "$email"
## Create ~/.ssh/.config file to persist SSH pass
cat <<EOF | tee -a ~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
EOF
## Install ssh keychain
sudo apt install keychain -y
## Add your SSH private key to the ssh-agent
## and store your passphrase in the keychain
ssh-add -K ~/.ssh/id_ed25519
## Start ssh agent
eval "$(ssh-agent -s)"
## Add your SSH private key to the ssh-agent.
## If you created your key with a different name,
## or if you are adding an existing key that has a
## different name, replace id_ed25519 in the command
## with the name of your private key file.
ssh-add ~/.ssh/id_ed25519
## Add the SSH key to your account on GitHub. For more information,
## see "Adding a new SSH key to your GitHub account."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment