git遇到的问题之“Please make sure you have the correct access rights and the repository exists.”...
對(duì)于git的提交一直很小心翼翼,感覺一不小心就會(huì)踩到莫名的坑。
?
這不,
?
某天commit 就遇到了On?branch?master?nothing to commit (working directory?clean)?
?
一查意思。你的分支很干凈?
?
干凈?excuse me?
?
然后git push origin master一下,漫長等待了彈出了fail:#¥%@(此處省略,我們看重點(diǎn))
?
Please make sure you have the correct access rights and the repository exists.
?
然后谷歌了一下,原來是ssh key有問題,連接不上服務(wù)器~~
然后我開始了死胡同~~
?
參閱了很多的答案,發(fā)現(xiàn)寫的都不是很完整,自己東摸索西摸索搞定了,怕忘記,記錄一下
?
1、首先我得重新在git設(shè)置一下身份的名字和郵箱(因?yàn)楫?dāng)初都忘了設(shè)置啥了,因?yàn)橛龅娇恿?#xff09;進(jìn)入到需要提交的文件夾底下(因?yàn)橹苯哟蜷_git Bash,在沒有路徑的情況下,根本沒!法!改!剛使用git時(shí)遇到的坑。。。)
git config --global user.name "yourname"
git config --global user.email“your@email.com"
注:yourname是你要設(shè)置的名字,your@email是你要設(shè)置的郵箱。
?
2、刪除.ssh文件夾(直接搜索該文件夾)下的known_hosts(手動(dòng)刪除即可,不需要git)
?
3、git輸入命令
$ ssh-keygen -t rsa -C "your@email.com"(請(qǐng)?zhí)钅阍O(shè)置的郵箱地址)
?
接著出現(xiàn):
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
?
請(qǐng)直接按下回車
?
然后系統(tǒng)會(huì)自動(dòng)在.ssh文件夾下生成兩個(gè)文件,id_rsa和id_rsa.pub,用記事本打開id_rsa.pub
?
將全部的內(nèi)容復(fù)制
?
4、打開https://github.com/,登陸你的賬戶,進(jìn)入設(shè)置
?
進(jìn)入ssh設(shè)置
?
在key中將剛剛復(fù)制的粘貼進(jìn)去
點(diǎn)擊add ssh key,
?
ok!
?
5、在git中輸入命令:
?
ssh -T git@github.com
?
然后會(huì)跳出一堆話。。
?
輸入命令:yes
?
回車
?
然后就會(huì)提示你成功了~~
?
淚牛滿面~~
?
最后退出git重新進(jìn)入路徑提交一下就可以了~~
?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/Free-Thinker/p/10273590.html
總結(jié)
以上是生活随笔為你收集整理的git遇到的问题之“Please make sure you have the correct access rights and the repository exists.”...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#中使用JavaScriptSeria
- 下一篇: 手机端实现6位短信验证码input输入框