如何从heroku访问私有github仓库?

Kam*_*i81 5 heroku ssh-keys

我有一个私人仓库,我试图在部署到Heroku时访问.但是,Heroku不允许我克隆私人仓库,并给我以下错误(正如我所料):

Host key verification failed.
       fatal: The remote end hung up unexpectedly
       Git error: command `git clone
       'git@github.com:pr/lm-models.git'
       "/tmp/build_3r0z0znww0zda/vendor/bundle/ruby/1.9.1/cache/bundler/git/lm-models-aab025aaadbe07202b16e1db7505ae1726f8723a"
       --bare --no-hardlinks` in directory /tmp/build_3r0z0znww0zda has failed.
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app
Run Code Online (Sandbox Code Playgroud)

我找到了这个,但不想以明文显示我的用户名/密码:

将heroku应用程序链接到私有(组织)github仓库

Tin*_*naW 6

这对我有用:

  1. 生成Github 访问令牌
  2. 在requirements.txt中列出私有模块如下:

    git+https://your_user_name:your_git_token@github.com/your_company/your_module.git
    
    Run Code Online (Sandbox Code Playgroud)


cat*_*sby 2

您需要在 Gemfile 中使用用户名/密码,或供应商依赖项。您还可以使用 Gemfury(假设它是宝石):