git 在不下载 repo 的情况下从 github 推送到 heroku
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3324586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Push from github to heroku without downloading repo
提问by opsb
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 download the contents of the repo onto the 3rd host. How do I do it?
我有一个 github 存储库,我想将其推送到 heroku 节点。第三位主持人将对此进行协调。由于我将大规模执行此操作,因此我想避免将存储库的内容下载到第三台主机上。我该怎么做?
回答by David Dollar
You can't push straight from Github to Heroku.
你不能直接从 Github 推送到 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.
您将不得不使用第三台主机来协调推送。这可以从 Github post-receive hook 中触发。
To sync straight across use something like:
要直接同步,请使用以下内容:
git remote add github [email protected]:user/repo.git
git remote add heroku [email protected]:app.git
git push heroku refs/remotes/github/master:refs/heads/master
回答by everyplace
Codeship.iodoes this as a service now, and automatically configures the appropriate git webhooks on public or private github repos.
Codeship.io现在将此作为一项服务来执行,并在公共或私有 github 存储库上自动配置适当的 git webhooks。
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.
还有其他一些“持续集成即服务”(CIAAS) 选项,但总的来说,它们可以解决您特别提出的问题:Web 钩子需要访问 3rd-party 服务,这反过来又可以触发heroku 构建过程。
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.
这些 CIAAS 主机充当第 3 方,通常为公共项目提供免费套餐。你也可以通过部署一个 web hook 接收服务器来推出你自己的,它可以拉和推送 git repos。
回答by everyplace
About a year after my previous answer about codeship.io, Heroku launched the beginnings of their Pipeline feature set, which includes proper Github integration.
在我之前关于codeship.io 的回答大约一年后,Heroku 推出了他们的 Pipeline 功能集的开始,其中包括正确的 Github 集成。
https://devcenter.heroku.com/articles/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.
整个管道流程非常强大,允许基于分支的临时实例、多个应用程序部署、staging->production 推广等。更多信息可以在 Heroku 的概述文章中找到。
回答by VonC
I don't think you can push directly from GitHub to another remote repo.
我认为您不能直接从 GitHub 推送到另一个远程存储库。
So if you have many apps to push, you may consider an organization using submodules, like in this SO question.
因此,如果您要推送许多应用程序,您可以考虑使用子模块的组织,例如在这个 SO 问题中。
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).
您仍然需要下载一个 repo 来将它推送到 Heroku 节点上,但至少您可以控制拉/推的内容(并在每次推送之间进行一些清理)。