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/



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM