Skip to content

Commit 2619eae

Browse files
committed
chore: update SSH key guide to recommend ed25519 algorithm and improve instructions
1 parent b150a1d commit 2619eae

1 file changed

Lines changed: 29 additions & 14 deletions

File tree

_posts/how-to-create-ssh-keys.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: Adding SSH Keys to Your GitHub Account
33
heading: How to add SSH keys to your GitHub account
44
description: Learn how to add SSH keys to your GitHub account. Boost your account's security and ease your workflow by securely connecting your local machine to your GitHub repositories.
55
createDate: 2023-12-08T01:07:13.290Z
6-
updateDate: 2023-12-08T01:07:13.290Z
7-
keywords: [ Adding SSH Keys, GitHub Account, Git Terminal, Existing SSH Keys, Generating SSH Key, SSH public key, SSH Key to GitHub Account ]
6+
updateDate: 2025-09-15T12:29:00.000Z
7+
keywords: [ Adding SSH Keys, GitHub Account, Git Terminal, Existing SSH Keys, Generating SSH Key, SSH public key, SSH Key to GitHub Account, ed25519 ]
88
categories: [ Tutorial, Project-Setup ]
99
featured: false
1010
---
@@ -14,7 +14,7 @@ featured: false
1414
Hello everyone!
1515

1616
Today, we are going to walk through the process of adding [SSH keys](https://www.ssh.com/academy/ssh-keys) to a GitHub
17-
account.
17+
account using the modern and secure ed25519 algorithm.
1818

1919
Before we begin, make sure you have Git installed on your system. If you haven't done this already, head over to
2020
the [Git website](https://git-scm.com/downloads), download the latest version, and install it.
@@ -36,25 +36,30 @@ This command lists all the files in your .ssh directory. If you don't find any,
3636

3737
Your SSH keys might use one of the following algorithms:
3838

39-
- ⛔️ DSA: It’s unsafe and even no longer supported since OpenSSH version 7, you need to upgrade it!
40-
- 🥴 RSA: It depends on key size. If it has 3072 or 4096-bit length, then you’re good. Less than that, you probably want
41-
to
42-
upgrade it. The 1024-bit length is even considered unsafe.
39+
- ⛔️ DSA: It's unsafe and even no longer supported since OpenSSH version 7, you need to upgrade it!
40+
- 🥴 RSA: It depends on key size. If it has 3072 or 4096-bit length, then you're good. Less than that, you probably want
41+
to upgrade it. The 1024-bit length is even considered unsafe.
4342
- 👌 ECDSA: It depends on how well your machine can generate a random number that will be used to create a signature.
44-
Theres also a trustworthiness concern on the NIST curves that being used by ECDSA.
45-
- 🥳 Ed25519: Its the most recommended public-key algorithm available today!
43+
There's also a trustworthiness concern on the NIST curves that being used by ECDSA.
44+
- 🥳 Ed25519: It's the most recommended public-key algorithm available today! This is what we'll use in this guide.
4645

4746
### Step 2: Generating a New SSH key
4847

4948
In your terminal, paste the following command:
5049

5150
```bash
52-
$ ssh-keygen -t rsa -b 4096 -C "shramko.dev@gmail.com"
51+
$ ssh-keygen -t ed25519 -C "shramko.dev@gmail.com"
5352
```
5453

5554
Replace `shramko.dev@gmail.com` with the email address you used to create your GitHub account. Then, you will be
5655
prompted to "Enter a file in which to save the key," - press Enter to accept the default file location.
5756

57+
**Note:** If you're using a legacy system that doesn't support ed25519, you can use RSA with 4096 bits instead:
58+
59+
```bash
60+
$ ssh-keygen -t rsa -b 4096 -C "shramko.dev@gmail.com"
61+
```
62+
5863
### Step 3: Adding Your SSH key to the ssh-agent
5964

6065
Make sure the `ssh-agent` is running:
@@ -66,10 +71,10 @@ $ eval "$(ssh-agent -s)"
6671
Then, add your new SSH key to the ssh-agent:
6772

6873
```bash
69-
$ ssh-add ~/.ssh/id_rsa
74+
$ ssh-add ~/.ssh/id_ed25519
7075
```
7176

72-
Note: replace "id_rsa" with the name of your key if you have used a different one.
77+
Note: If you used RSA instead, replace "id_ed25519" with "id_rsa".
7378

7479
### Step 4: Adding the SSH key to Your GitHub Account
7580

@@ -81,7 +86,17 @@ Note: replace "id_rsa" with the name of your key if you have used a different on
8186
To copy the SSH key, go back to your terminal and type:
8287

8388
```bash
84-
$ clip < ~/.ssh/id_rsa.pub
89+
$ clip < ~/.ssh/id_ed25519.pub
90+
```
91+
92+
**For Linux users, use:**
93+
```bash
94+
$ cat ~/.ssh/id_ed25519.pub
95+
```
96+
97+
**For macOS users, you can also use:**
98+
```bash
99+
$ pbcopy < ~/.ssh/id_ed25519.pub
85100
```
86101

87102
Paste the key into the 'Key' input on GitHub, then click 'Add SSH Key'.
@@ -99,4 +114,4 @@ $ ssh -T git@github.com
99114
You should see a message welcoming you: "Hi [Your GitHub username]! You've successfully authenticated, but GitHub does
100115
not provide shell access."
101116

102-
You've now successfully added an SSH Key to your GitHub account.
117+
You've now successfully added a modern, secure ed25519 SSH Key to your GitHub account.

0 commit comments

Comments
 (0)