[[SSH]] authentication requires more work to set up but is more secure than HTTPS.
To set up SSH, refer to the official [GitHub guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or follow the instructions below.
## Instructions
1. In Git Bash, paste the text below, substituting the email address associated with your GitHub account.
```bash
ssh-keygen -t ed25519 -C "
[email protected]"
```
> [!info]- What is `ed255519`?
> `ed25519` specifies `ssh-keygen` use the Ed25519 algorithm. If that doesn't work for you, see the [GitHub guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) for alternatives.
2. If this is the first SSH key you've set up, accept the default file location by hitting enter. If not, enter a path to a new file (e.g, `~/.ssh/id_ed25519_work`). DO NOT override the existing SSH key.
3. Provide an empty passphrase (so you don't have to type it in each time or log it to a SSH handler). Alternatively enter a passphrase and see ["Working with SSH key passphrases](https://docs.github.com/en/articles/working-with-ssh-key-passphrases)."
4. Start the ssh-agent in the background.
```bash
eval "$(ssh-agent -s)"
```
5. Add your SSH private key to the ssh-agent (note the filename is the default filename, if you changed the filename in step 2, also change it here).
```bash
ssh-add ~/.ssh/id_ed25519
```
6. Copy the newly created key to your clipboard.
```bash
clip < ~/.ssh/id_ed25519.pub
```
7. Navigate to your GitHub account, sign in if needed.
8. In the upper-right corner of the page, click your profile photo then click **Settings**.
9. In the "Access" section of the sidebar, click **SSH and GPG keys**.
10. Click **New SSH key**.
11. Edit the Title field to describe which computer the key is stored on.
12. Specify *Key Type* as "Authentication Key".
13. Paste the key from the clipboard in the *Key* field.
14. Click **Add SSH key**.
Repeat the above process for any other GitHub accounts.
When [[clone|cloning]] a repo, use the SSH URI instead of HTTPS.
If you have existing repositories that use HTTPS, [[update existing repository remotes]].