1 2
| ssh-keygen -t rsa -b 4096 -C "fengyujie.jayden@jd.com" ssh-keygen -t ed25519 -C "fengyujie.jayden@jd.com"
|
1 2
| eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519
|
在 ~/.ssh/config
文件中添加配置(没有就新建一个):
1 2 3 4 5 6 7 8 9 10 11
| Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519
Host github.com User git Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa Port 443
|
pbcopy < ~/.ssh/id_ed25519.pub
然后去 GitHub / GitLab / Gitee 等账号的 SSH Keys 设置中粘贴。
ssh -T git@github.com