权限被拒绝(公钥)无法从远程存储库读取
Permission denied(publickey) Could not read from remote repository
我正在尝试将我的网站推送到我在 digital ocean 上的服务器,但我一直收到此错误。
local-machine@my-server-address: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已经设置了 ssh 密钥并在我的服务器上使用了它。我可以通过 ssh 进入该站点,但是当我尝试使用 git 远程时,访问被拒绝。我仔细检查了我的存储库。
一件非常明显的事情是您正在使用 SSH 密钥,而发生的事情是 digital ocean 无法验证你。 “所以,要么你没有设置 SSH 密钥,因为你没有在你的机器上设置,要么你的密钥没有与你的 digital ocean 帐户相关联。
您可能想尝试的另一个选项是使用 HTTPS URL 而不是 SSH URL 推送它以避免必须处理 SSH 密钥.
您可能想进一步阅读 git Error: Permission denied (publickey)
谢谢大家的帮助。我想通了这个问题。我在没有指定用户的情况下添加了一个遥控器。
git remote add production ssh://my-server-address/var/repo/site.git
而不是
git remote add production ssh://root@my-server-address/var/repo/site.git
检查 git remote -v
的输出。确保您指向正确的存储库。
答案是给 Github 用户的。根据 url: https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
在 ~/.ssh/config
中添加一行:
Host *
User git <-------this line.
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
我正在尝试将我的网站推送到我在 digital ocean 上的服务器,但我一直收到此错误。
local-machine@my-server-address: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已经设置了 ssh 密钥并在我的服务器上使用了它。我可以通过 ssh 进入该站点,但是当我尝试使用 git 远程时,访问被拒绝。我仔细检查了我的存储库。
一件非常明显的事情是您正在使用 SSH 密钥,而发生的事情是 digital ocean 无法验证你。 “所以,要么你没有设置 SSH 密钥,因为你没有在你的机器上设置,要么你的密钥没有与你的 digital ocean 帐户相关联。
您可能想尝试的另一个选项是使用 HTTPS URL 而不是 SSH URL 推送它以避免必须处理 SSH 密钥.
您可能想进一步阅读 git Error: Permission denied (publickey)
谢谢大家的帮助。我想通了这个问题。我在没有指定用户的情况下添加了一个遥控器。
git remote add production ssh://my-server-address/var/repo/site.git
而不是
git remote add production ssh://root@my-server-address/var/repo/site.git
检查 git remote -v
的输出。确保您指向正确的存储库。
答案是给 Github 用户的。根据 url: https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
在 ~/.ssh/config
中添加一行:
Host *
User git <-------this line.
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa