Git SSH Key
An SSH key is a pair of files: a private key that stays on your computer, and a public key (ending in .pub) that you add to your GitHub, Bitbucket or GitLab account.
With the key in place, you can use SSH URLs like git@github.com:w3schools-test/hello-world.git and push without typing a password. Never share the private key.
Make a new key
Here -f names the file and -N "" sets an empty passphrase. Leave out -N and ssh-keygen asks you for a passphrase, which is safer:
ssh-keygen -t ed25519 -C "test@example.com" -f ~/.ssh/id_ed25519 -N ""
Generating public/private ed25519 key pair.
Your identification has been saved in /home/user/.ssh/id_ed25519
Your public key has been saved in /home/user/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:kf1Ip6knZLlFhiU/JargVR8bvfL+0qTAZG9JQM+76yE test@example.com
The key's randomart image is:
+--[ED25519 256]--+
| o.*.. |
| . X.O. |
| . . = X.+. |
| . o . *+Bo. |
| . . S+==o. |
| o +o =.. |
| + E+o+ |
| o .+o. |
| .oo. |
+----[SHA256]-----+
Show the public key
Copy this line into the SSH keys page of your account:
cat id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJYxImqL2uxvFAbghKhDd1PWMhXsN4pBxnSDXIrZWVO test@example.com