能够通过 SSH 连接到远程服务器,但无法 git 推送生产

Able to SSH into remote server, but unable to git push production

我正在按照 this guide 关于如何在远程服务器上设置推送到生产环境的第 12 步。

当我尝试 git 推送生产主机时遇到访问被拒绝的错误。

user@example.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

但是,我可以通过 ssh root@example.com.

登录

我在 windows 上使用 Putty 和 Laragon。

此问题的解决方案是删除当前的生产远程并专门使用 root 用户重新添加它。