git第一次clone別人的github項目包

使用git-clone命令從github上同步github上的代碼庫時,如果使用SSH鏈接,而你的SSH key沒有添加到github帳號設置中,系統會報下面的錯誤:

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

配置ssh key:https://www.jianshu.com/p/7d57ce4147d3

ssh-keygen -t rsa -C "[email protected]"

其中要你輸入什麼,不管就一路回車
在這裏插入圖片描述
之後

ssh -v git@github.com

然後生成ssh公鑰

ssh-add ~/.ssh/id_rsa

C:\Users\用戶名\.ssh的文件夾下用記事本打開id_rsa.pub
然後複製全部文本

在github的網站裏面,進入Settings
在這裏插入圖片描述
添加sshkey就好了
在這裏插入圖片描述
之後正常配置config

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"

執行git clone就行

$ git clone git@github.com:ruanyf/react-demos.git

然後阮一峯的react項目包就克隆下來了
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章