Push from github to heroku without downloading repo

前端 未结 4 1720
南笙
南笙 2020-12-01 01:08

I have a github repo that I want to push to a heroku node. A 3rd host will be co-ordinating this. As I\'m going to be doing this on a large scale I want to avoid having to d

相关标签:
4条回答
  • 2020-12-01 01:15

    You can't push straight from Github to Heroku.

    You're going to have to use the third host to coordinate the push. This could be fired from a Github post-receive hook.

    To sync straight across use something like:

    git remote add github git@github.com:user/repo.git
    git remote add heroku git@heroku.com:app.git
    
    git push heroku refs/remotes/github/master:refs/heads/master
    
    0 讨论(0)
  • 2020-12-01 01:15

    Codeship.io does this as a service now, and automatically configures the appropriate git webhooks on public or private github repos.

    There are a few other "continuous integration as a service" (CIAAS) options out there, but in general they get around the problem you're specifically presenting: web hooks need to hit a 3rd-party service, which in turn can trigger the heroku build process.

    These CIAAS hosts act as the 3rd-party, and usually offer a free tier for public projects. You can also roll your own by deploying a web hook receiving server, which can both pull and push git repos.

    0 讨论(0)
  • 2020-12-01 01:16

    I don't think you can push directly from GitHub to another remote repo.

    So if you have many apps to push, you may consider an organization using submodules, like in this SO question.

    You would still have to download a repo to push it on the Heroku node, but at least you can control what to pull/push (and do some cleaning between each push).

    0 讨论(0)
  • 2020-12-01 01:32

    About a year after my previous answer about codeship.io, Heroku launched the beginnings of their Pipeline feature set, which includes proper Github integration.

    https://devcenter.heroku.com/articles/github-integration

    The whole pipeline flow is really powerful, allowing for temporary instances based on branches, multiple app deployments, staging->production promotion, etc. More information can be found on Heroku's overview article.

    0 讨论(0)
提交回复
热议问题