从github克隆到heroku应用程序

时间:2013-07-04 15:56:17

标签: heroku github

我正在开发一个在Heroku上运行的部署应用程序,它允许我将分支从克隆的git仓库推送到其他机器进行部署。

当我尝试从github克隆存储库时(来自ruby应用程序,如果重要),我收到以下错误:

Host key verification failed

fatal: The remote end hung up unexpectedly.

为了解决这个问题,我在一个RSA密钥中检查了我已添加到我的github帐户到heroku应用程序,但问题仍然存在。

我试图从我的应用中调用ssh-add,但收到以下错误:

Could not open a connection to your authentication agent

我尝试用ssh-agent打开一个bash shell,没有任何效果。这是我尝试添加ssh密钥的代码块。

ruby def self.add_ssh_key(path='~/.ssh') activate_ssh_agent = %x{exec ssh-agent bash} command = %x{ssh-add #{path}} if $?.exitstatus != 0 msg = "Error: unable to add ssh-key" end end

我有什么办法吗?

1 个答案:

答案 0 :(得分:0)

我改变了我的方法。

使用SSH已经证明令人沮丧所以我只是改为通过https检查,凭证可以放入实际的仓库名称,这些凭证可以作为环境变量包含在heroku应用程序中。

相关代码:

def self.clone_repo(repository_address)
  username = ENV["GITHUB_USER_NAME"]
  password = ENV["GITHUB_PASSWORD"]
  repo = "https://#{username}:#{password}@github.com/#{repository_address}"
  command = %x{git clone #{repo}}

  if $?.exitstatus != 0
    msg = "Git error: unable to clone repository #{repository_address}"
  end
end
相关问题