xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

GitHub SSH key

GitHub SSH key

https://help.github.com/en/github/authenticating-to-github

steps

HTTPS clone !== SSH clone

https clone bug

SSH clone OK

testing

step 0. Checking for existing SSH keys

check

$ ls -al ~/.ssh

# id_rsa.pub
# id_ecdsa.pub
# id_ed25519.pub

$ cat ~/.ssh/id_rsa.pub

$ cat ~/.ssh/id_rsa

https://help.github.com/en/github/authenticating-to-github/checking-for-existing-ssh-keys

step 1. Generating a new SSH key

create

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

step 2.

add

https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

https://github.com/settings/ssh/new

step .3

将 SSH 密钥添加到 ssh-agent

zh-Hans

https://help.github.com/cn/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent


$ eval "$(ssh-agent -s)"
# 修改 ~/.ssh/config 文件以自动将密钥加载到 ssh-agent 中并在密钥链中存储密码。

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa


$ ssh-add -K ~/.ssh/id_rsa

step 4.test

$ ssh -T git@github.com

OK 👌


GPG key

https://help.github.com/articles/generating-a-gpg-key/


posted @ 2020-03-26 22:27  xgqfrms  阅读(204)  评论(21编辑  收藏  举报