Push failed
Warning: Permanently added the RSA host key for IP address 'xx.74.xxx.119' to the list of known hosts.
git@github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解決方案:
ssh-keygen -t rsa -C "xxxx";xxxx為github的賬戶名
Enter file in which to save the key ("當(dāng)前所在路徑"): “給文件起個(gè)名字”
這里隨便起一個(gè)名字,這樣問題就出來了砾赔,你起的這個(gè)名字沒有和ssh內(nèi)設(shè)定的名字保持一致基显,所以使用命令
ssh -T git@github.com
的時(shí)候報(bào)出Permission denied (publickey).這個(gè)錯(cuò)誤
當(dāng)出現(xiàn)這個(gè)問題時(shí),有兩個(gè)比較簡(jiǎn)單的解決辦法:
給文件起名字的時(shí)候使用 ‘ id_rsa ’ 這個(gè)名字
如果親非要自己取名子,那就使用
ssh-add ~/.ssh/你的名字
將自己起的名字加入到ssh中
這樣再使用
ssh -T git@github.com
就會(huì)看到你想要的效果了市埋。
注:在生成密鑰的時(shí)候刻蚯,請(qǐng)?jiān)?“ ~/.ssh/ ”目錄下操作∈JВ或者生成后把文件移動(dòng)到“ ~/.ssh/ ”目錄下屈尼。