Skip to content

Instantly share code, notes, and snippets.

@sharon-xa
Last active May 14, 2024 12:52
Show Gist options
  • Save sharon-xa/7a9d8c0b9e99c4db550106e73c8e499e to your computer and use it in GitHub Desktop.
Save sharon-xa/7a9d8c0b9e99c4db550106e73c8e499e to your computer and use it in GitHub Desktop.
Create an ssh key to use with github (Linux)

Check if you have name and email

git config user.name
git config user.email

Set your name and email

git config --global user.name "John Doe"
git config --global user.email john_doe@example.com

Set your default editor for writing commit messages

git config --global core.editor "The editor you want"
  1. Make sure that you have a directory named ".ssh" in your home directory, so the full path is "~/.ssh", if you don't have the directory just create it
  2. cd to ".ssh"
  3. Then run the following command:
ssh-keygen -t ed25519 -C "your_email@example.com"
  1. Adding your SSH key to the ssh-agent (this works with bash, so if you're using fish just run bash and run the command)
eval "$(ssh-agent -s)"
  1. Add your SSH private key to the ssh-agent
ssh-add ~/.ssh/id_ed25519

Now add the ssh key to GitHub

  1. Screenshot_20240513_013740
  2. Screenshot_20240513_014033
  3. Screenshot_20240513_014258
  4. Screenshot_20240513_014359
  5. cat ~/.ssh/id_ed25519.pub copy what's inside the file and paste it into the key Screenshot_20240513_014512
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment