克隆代碼的時候你或許或遇到這樣一個提示。:
還有第二種情況:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
第一個是因爲沒有配置ssh。第二個是原因在於你沒權限,找下倉庫的主子,把你的用戶名給他,讓他給你開權限
生成一下ssh的key;以下是步驟:
1,git執行 命令生成ssh的key
ssh-keygen -t rsa -C "你的郵箱"
然後有提示的話一直回車就行了,大概五次;然後會生成ssh的key了。
2,查看shh的key值
一般在用戶下的 .ssh/id_rsa.pub文件。
cat ~/.ssh/id_rsa.pub
如果是在win下的文件夾查看的話,一般是在
C:/用戶/Administrator/.ssh/id_rsa.pub
複製裏面的內容,然後複製到代碼倉庫的設置裏,這裏以阿里爲例
複製一下,key的內容,大概是這樣子的:
命令行是這樣的
我們複製到倉庫裏
看看成了之後的樣子
3, 再次克隆,發現ok了
來個例子,再次強調命令 :
ssh-keygen -t rsa -C "[email protected]"