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项目包就克隆下来了
在这里插入图片描述

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