github - 關於git push沒有權限的問題,已設定公鑰
伊谢尔伦
伊谢尔伦 2017-05-02 09:24:04
0
1
748

首先呢,我已經弄好了ssh的密鑰,ssh -T git@githun.com是可以的,回傳:
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
但是,當我想要git push的時候,總是失敗,提示是:
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: xxxxxxxxxxxx
請問這是什麼情況,

我執行的是
git remote add origin git@github.com:xxxxxxx/test.git
git push -u origin master

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回覆(1)
仅有的幸福

設定Git的user name和email

git config --global user.name "yourname"
git config --global user.email "youremail"

產生SSH密鑰

查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
生存密钥:
ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub

新增金鑰到ssh:ssh-add 檔案名稱,需要之前輸入密碼.

在github上加入ssh金鑰,這要加入的是「id_rsa.pub」裡面的公鑰。
開啟https://github.com/,在設定中加入金鑰

测试: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)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.

测试成功就可以push code了.
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板