git clone 时遇到的问题
1.权限问题
p@Dell-R730:~/sssessryossng/github$ git clone git@github.com:luheng/deep_srl.git
Cloning into 'deep_srl'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
1.1原因
没有配置 id_rsa.pub
,因此,把它配置到github中就解决了
1.2 疑惑
git clone
时为什么需要pub key?
原来这是ssh设计时就是这样规定的。在管理Git项目上,很多时候都是直接使用https url克隆到本地,当然也有有些人使用SSH url克隆到本地。这两种方式的主要区别在于:使用https url克隆对初学者来说会比较方便,复制https url然后到git Bash里面直接用clone命令克隆到本地就好了,但是每次fetch和push代码都需要输入账号和密码,这也是https方式的麻烦之处。而使用SSH url克隆却需要在克隆之前先配置和添加好SSH key,另外ssh默认是每次fetch和push代码都不需要输入账号和密码,如果你想要每次都输入账号密码才能进行fetch和push也可以另外进行设置