cd ~/.ssh
ssh-keygen -t ed25519 -C "your_email@example.com"
不設密碼的話直接按 enter
1
2
3
Enter file in which to save the key (/home/username/.ssh/id_ed25519): /home/username/.ssh/github_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
在 GitHub 放 public key
複製公鑰放到 GitHub
1
cat id_ed25519.pub
貼到這邊:
Settings -> SSH and GPG keys → New SSH key
連線測試
1
ssh -T git@github.com
~/.ssh/config
1
2
3
4
Host github.com
HostName github.com
User ashirleyshe
IdentityFile ~/.ssh/id_rsa