[英]GitHub: Permission denied (publickey). Unable to push to server
我收到錯誤消息:
VehicleXray git:(master) ✗ git push live master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
命令“ git remote -v”顯示:
live ssh://root@vehiclexray.com/var/repo/VehicleXray.git (fetch)
live ssh://root@vehiclexray.com/var/repo/VehicleXray.git (push)
origin https://github.com/enayet123/VehicleXray.git (fetch)
origin https://github.com/enayet123/VehicleXray.git (push)
我顯然是GitHub的新手,對如何使用它的了解很少。 我已經嘗試用本地存儲在筆記本電腦上的私鑰以及提供給服務器和GitHub的公鑰創建SSH密鑰。 我究竟做錯了什么?
看起來您的服務器公鑰可能有問題。 嘗試使用ssh登錄:
ssh -vvv root@vehiclexray.com
-vvv
選項打印調試消息
您的公鑰應位於~/.ssh/authorized_keys
文件中。 此外,還必須在sshd_config
文件中啟用公鑰身份驗證: PubkeyAuthentication yes
。 對該文件進行更改后,必須重新啟動ssh。
另外,選擇root
作為用戶可能不是最好的主意。 可以在sshd級別禁用以root身份登錄。 您應該創建非特權用戶來訪問git存儲庫。
另一件事:只能推送到裸倉庫中。 您可以使用git clone --bare <repository>
命令克隆裸倉庫。
詳細信息: 服務器上的Git-設置服務器
您的問題與Github無關。 您在將ssh推送到ssh://root@vehiclexray.com/
。 解決方案與GH相同:將您的公鑰復制到root@vehiclexray.com
:
ssh-copy-id root@vehiclexray.com
查看git hubs幫助https://help.github.com/articles/pushing-to-a-remote#what-can-i-push-to
嘗試這個
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.