Welcome! This project provides an interactive Bash script to help you generate and configure SSH keys for use with GitHub. It guides you step-by-step to create a secure SSH key, add it to your GitHub account, and configure your SSH client for seamless authentication.
- π¨ Interactive prompts with color and emoji for a friendly user experience
- π§ Email validation to ensure correct input
- π Choice of key type: modern (ed25519) or legacy (RSA)
- π Customizable key file name and location
- β‘ Automatic SSH key generation and addition to the ssh-agent
- π Displays your public key and provides clear instructions for adding it to GitHub
- π€ Optional automatic upload of your public key to GitHub using a personal access token
- π οΈ Updates your
~/.ssh/config
for GitHub usage - π Tests your SSH connection to GitHub
- π§ Bash shell (tested on macOS and Linux)
- π
ssh-keygen
andssh-agent
utilities - π
curl
(for optional automatic upload)
- Clone or download this repository.
- Run the script:
bash setup-ssh-keys.sh
- Follow the interactive prompts:
- π§ Enter your GitHub email address (validated for correct format)
- π Choose the SSH key type (ed25519 recommended)
- π Optionally specify a custom file name for your key
- β‘ The script will generate your SSH key and add it to the ssh-agent
- π Your public key will be displayed for you to copy
- π€ Optionally, you can upload the key automatically to GitHub by providing your username and a personal access token with
admin:public_key
scope - π οΈ The script will update your SSH config and test the connection to GitHub
- π« Never share your private key. Only the public key (
.pub
file) should be uploaded or shared. - π‘οΈ If you use the automatic upload feature, your GitHub personal access token is only used locally and not stored.
Pablo Pin - devidence.dev Β©
Pablo Pin - devidence.dev Β©