1. 檢查是否已經(jīng)有SSH Key。
$cd ~/.ssh
如果說(shuō)沒有這個(gè)目錄,就直接看第三步
2. 備份
3. 生成一個(gè)新的SSH债鸡。
$ ssh-keygen -t rsa -C "email"
之后直接回車,不用填寫東西铛纬。
之后會(huì)讓你輸入密碼厌均。然后就生成一個(gè)目錄.ssh ,里面有兩個(gè)文件:
id_rsa , id_rsa.pub
4. 把這個(gè)SSH放到github上告唆。
用公鑰棺弊。先在GitHub上注冊(cè)一個(gè)用戶,然后進(jìn)入account-setting 擒悬,把id_rsa.pub的內(nèi)容復(fù)制進(jìn)去就可以了模她。
5.測(cè)試
$ ssh git@github.com
The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.ERROR: Hi Kevin You’ve successfully authenticated, but GitHub does not provide shell accessConnection to github.com closed.