Connect GitHub using openssh
Add new ssh key
bash
ssh-keygen -t ed25519 -C "youremail@example.com"
1
console
$ ssh-keygen -t ed25519 -C "youremail@example.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/username/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_ed25519
Your public key has been saved in /home/username/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:myLr0FO3JEIwZGAP74SZ1f82WHxuzsCakb5xdaHVYpQ youremailp@example.com
The key's randomart image is:
+--[ED25519 256]--+
|.==.. .. |
|..Oo . .E. |
| + +. . . = . |
| o. . o .+ o |
| .. o S oo . |
| . o B X.o. |
| . + o.O.* |
| . + =o o |
| .o .. |
+----[SHA256]-----+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
TIP
passphrase
can be ignored.
Add ssh key to ssh-agent
bash
eval "$(ssh-agent -s)"
1
console
$ eval "$(ssh-agent -s)"
Agent pid 55041
1
2
2
TIP
For some shell, it may not be able to execute this command correctly(fish
for example), for that case, use bash
instead.
bash
ssh-add ~/.ssh/id_ed25519 # replace id_25519 with actual name
1
Check existing ssh keys
bash
ls -al ~/.ssh
1
Add ssh key to your GitHub account
Test your ssh connection
bash
ssh -T git@github.com
1
console
$ ssh -T git@github.com
Hi github_username! You've successfully authenticated, but GitHub does not provide shell access.
1
2
2
Congratulations! Your ssh connection has successfully set up.
If you see somthing like this which means you did something wrong.
plain
...
Agent admitted failure to sign using the key.
debug1: No more authentication methods to try.
Permission denied (publickey).
1
2
3
4
2
3
4