今天在csdn的GitCode新建了一個項目,然后在windows下git clone時出現(xiàn)錯誤
git@gitcode.net: Permission denied (publickey).
fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists.
完整報錯如下圖
直接說結(jié)論
因為沒有把電腦的SSH public key添加到項目的git服務(wù)器上
操作如下
1. 打開運行,輸入services.msc,確定
?2. 找到 OpenSSH Authentication Agent 服務(wù),需開啟它,開啟后如下圖
?3. 打開cmd命令窗,執(zhí)行?ssh-keygen -t rsa -C "你的郵箱地址"
如下圖(279533105@qq.com是我的郵箱),中間會向你確認(rèn)一些東西,一路回車即可
?我用的是Administrator用戶,執(zhí)行完后,可以在?C:\Users\Administrator\.ssh 目錄下生成 id_rsa 和?id_rsa.pub 這兩個文件。如果你沒有用Administrator用戶,也是在類似的目錄下
4. 用記事本打開id_rsa.pub文件
?把這個文件的全部內(nèi)容復(fù)制出來,拷貝到你git項目的SSH Keys右側(cè)的編輯框,如下圖
?最后點擊下面的Add key按鈕即可
5. 再次用git clone 會發(fā)現(xiàn)已經(jīng)可以了,這是我的效果圖文章來源:http://www.zghlxwxcb.cn/news/detail-668545.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-668545.html
到了這里,關(guān)于win10下解決git報錯 Permission denied(publickey)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!