git 問題

git clone 時遇到的問題

1.權限問題

p@Dell-R730:~/sssessryossng/github$ git clone [email protected]: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也可以另外進行設置

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