git pull出錯fatal:Please make sure you have the correct access rights.and the repository exists.
初學liunx,真是坑爹很多了,每天的錯誤。。。
Warning: Permanently added the RSA host key for IP address ‘192.168.25.*’ to the list of known hosts.
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
解決方法:
終端輸入.
ssh-keygen -t rsa -C “*.hu”//注意。*.hu為使用者名稱
如果執行成功。返回
Generating public/private rsa key pair.
Enter file in which to save the key (/home/*.hu/.ssh/id_rsa):
在這裡就是設定儲存地址了.反正我是直接按的回車
然後還會返回
Enter passphrase (empty for no passphrase):
再次直接回車。
Enter same passphrase again:
再次回車。
Your identification has been saved in /home/*
Your public key has been saved in /home/*.hu/.ssh/id_rsa.pub.
The key fingerprint is:
這裡有一串數。我把他遮蔽了。
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| |
| |
| o |
| + . S |
| . = . o |
| o + +o.o |
|E o . o.=+. |
|.+ ==+ooo. |
+—————–+
這樣SSH key就生成了。直接cat一下就好了。
000000:~/a$ cat /home/*.hu/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQ(我遮蔽了)
把顯示出來的直接新增到伺服器 設定裡邊的SSH keys add.
回來在git pull
就開始遠端拷貝程式碼了