git SSH連線

yurukuma
May 3, 2021

檢查ssh金鑰是否存在

ls -al ~/.ssh
  1. 產生git ssh key
ssh-keygen -t rsa -b 4096 -C "GitHub email address"//rsa是本機端的 ssh key,私密設定
rsa.pub是給 github 網站上,設定在github account 的 ssh

設定ssh key密碼

tips:產生的ssh key會在「c:\user\username\.ssh」資料夾

2. 設定金鑰代理

eval "$(ssh-agent -s)" //啟動ssh代理服務器ssh-add ~/.ssh/id_rsa //將私鑰及加入到 SSH 代理上

註: 如果沒有加入代理,每次push還是要打密碼

3. 複製 SSH Key 至剪貼簿

clip < ~/.ssh/id_rsa.pub

3. 將 SSH key 加到 github 帳號

到github settings > SSH and GPC keys

把前面複製的 SSH Key 貼到中間框框裡,最後選擇 Add SSH key,再輸入github密碼就可以了。

4. 測試 SSH Key 聯繫

ssh -T git@github.com

Reference

[製作 Git SSH 公開金鑰 For Windows](https://trunk-studio.com/blog/ssh-for-windows/)

[Github 的 SSH 金鑰設定](https://eason920.medium.com/github-%E7%9A%84-ssh-%E5%8D%94%E8%AD%B0%E8%A8%AD%E5%AE%9A-%E4%B8%8A-45f26e4564f6)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

yurukuma
yurukuma

Written by yurukuma

I’m a front-end developer. Let’s learning by doing:)

No responses yet

Write a response