两台服务器之间的 Git SSH "Permission denied"

标签 git ssh

我有两台安装了 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/

相关文章:

git - 如果检测到更改中的特定短语,如何防止 git commit?

git - 撤销意外的 git stash pop

ruby-on-rails - 使用sqlite3进行开发的Rails应用程序不会部署到heroku中

git - 在 git 历史记录中查找特定作者触及的所有文件?

python - 如何通过子进程模块调用 ssh 以便它使用 SSH_ASKPASS 变量

git - Xcode 4混帐: 'moving' local git project to our remote server

git - Gitlab-CI 中存在已删除的标签

ssh - docker run找不到名称标志参数

linux - Github 不响应 SSH

php ssh2_exec 不执行 'su' 命令