[英]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.