【问题标题】:Git can't clone project via ssh DeployerGit 无法通过 ssh Deployer 克隆项目
【发布时间】:2021-02-05 14:29:54
【问题描述】:

我正在使用 Deployer 将项目克隆到服务器上,但尽管设置了部署密钥,但由于某种原因,通过 SSH 克隆失败:

ERROR: Repository not found.
fatal: Could not read from remote repository.

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

我已采取的步骤:

  1. 在我正在克隆我的项目的服务器上生成新密钥:ssh-keygen -t rsa -b 4096 -C "your_email@example.com",我的密钥文件位于此格式:form_simple_id_rsa,当然还有 pub 版本。
  2. 做了eval并添加了密钥:ssh-add -k ~/.ssh/form_simple_id_rsa
  3. 已测试连接,一切正常。
  4. form_simple_id_rsa.pub 密钥添加到我的存储库作为部署密钥,存储库所有者不是我的帐户,我是此存储库的协作者,但服务器的密钥已链接到项目,因此它应该能够克隆。
  5. 在我的项目中设置部署程序以使用我的主机、端口和我制作的新密钥(因为有几个密钥)等:
host('project')
    ->port(myport)
    ->identityFile('~/.ssh/form_simple_id_rsa')
    ->stage('production')
    ->set('repository', 'git@github.com:company/project.git')
    ->user('root')
    ->set('deploy_path', '/var/www/path');
  1. 尝试部署,得到退出代码并报错:
Exit Code: 128(Invalid exit argument)

ssh -A -tt命令失败。

【问题讨论】:

    标签: php git ssh php-deployer


    【解决方案1】:

    如果这不是 DEployer 版本问题 (as in here),我会尝试:

    • 生成和测试没有密码的密钥(为了避免ssh-add step,确保不需要密码)
    • 使用-m PEM 生成密钥,以使用旧的 PEM 格式而不是新的 OPENSSH 格式,以防它有任何影响

    【讨论】:

      猜你喜欢
      • 2021-09-09
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-24
      • 2014-03-06
      相关资源
      最近更新 更多