我有两台安装了 Git(版本 2.7)的服务器,一台是“开发”服务器,另一台是“生产”服务器。当我尝试使用
将开发服务器上的主存储库推送到生产服务器时 git push live master
我收到一条错误消息:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这是说 SSH 不起作用吗?我已将 .ssh 文件更改为 700,将authorized_keys 文件更改为 600。我将存储库更改为 766。这是我的开发服务器上的 git 配置:
[remote "live"]
url = ssh://admin@PRODUCTION-IP-ADDRESS/home/admin/repo/site.git
fetch = +refs/heads/*:refs/remotes/live/*
我一直在尝试寻找解决方案,但我遇到的所有内容都是针对 Github 的。 git 知道寻找 ~/.ssh 吗?
最佳答案
完全忘记尝试使用我的开发服务器上的终端来 ssh admin@Production_IP_ADDRESS。无法连接,双方都没有 key ,开发服务器上只有生产 SSH key ,反之则不然。以前不知道。
关于两台服务器之间的 Git SSH "Permission denied",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35008331/