Heroku——从多台计算机部署?
我有两台计算机,我希望它们都能够从 github 上的同一个存储库拉取/推送,并部署到 heroku 上的同一个应用程序。我知道 Heroku 允许您在另一台计算机上克隆其 git 存储库,以便它也可以链接起来,但我不希望第二台计算机克隆 Heroku 存储库 - 我希望它克隆 git 存储库,然后让两台计算机能够在任一部署时更新 heroku...我该怎么做?两者已经成功连接到同一个 github,但我现在想将它们连接到同一个 heroku 应用程序。
I have two computers and I want both of them to be able to pull/push from the same repo on github as well as deploy to the same app on heroku. I know that Heroku allows you to clone its git repo on another computer so it can be linked up too, but I don't want the second to clone the heroku repo - i want it to clone the git repo and then have both computers be able to update heroku when either one deploys... how do I do this? Already the two are connected to the same github successfully but I now want to connect them to the same heroku app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
git Remote add heroku [电子邮件受保护]:your_app_name.git< /代码>
git remote add heroku [email protected]:your_app_name.git
git push heroku
。因此,对所有需要使用 heroku 命令的计算机执行此操作:
并且您可以使用这些配置同时推送到 Git 和 Heroku:
然后 git push heroku 将会推送到所有计算机。
git push heroku
.So do this to all your computers where you want heroku commands:
And the you can push to both Git and Heroku at the same time with these configurations:
Then
git push heroku
will push to all.基于上面的答案,但随着 Heroku 仪表板似乎发生了变化而更新:
[email protected]:your-app_name-xxxx.git,如上所述)
Building on the answers above, but updating as the Heroku dashboard appears to have changed:
[email protected]:your-app_name-xxxx.git, as mentioned above)
我通常将所有 Heroku 项目存储在一个与我所有计算机同步的 dropbox 文件夹中(也可作为非常方便的备份层) - 我还将我的 SSH 密钥存储在 dropbox 中,然后每台计算机将 ~/.ssh 符号链接到保管箱路径 - 这样,我可以在多台计算机上为同一个帐户使用相同的密钥。
我从来没有从 Heroku 中提取过项目,因为在 dropbox 文件夹中工作意味着我所有的计算机都使用相同的代码,但如果你使用 Github,那么你不需要从 Heroku 克隆,因为本地和 github 上的主分支应该是什么目前已在 Heroku 上上线,然后您应该在合并到 master 的分支中工作才能上线。
这意味着我可以在任何计算机上工作,并且面前有相同的代码,只需要捆绑/迁移我的项目即可启动并运行,但没有理由不能只进行项目设置并从 github 中提取无论您在哪台计算机上添加,只要您在两台计算机上都添加 heroku 遥控器,就可以了。
I typically store all my Heroku projects in a dropbox folder that is sync'ed to all my computers (also doubles as a very handy backup layer) - I also store my SSH keys in dropbox and then each computer symlinks ~/.ssh to the dropbox path - that way, I use the same key across multiple computers for the same account.
I have never pulled a project from Heroku since working in dropbox folder means all my computers are using the same code but if you're using Github then you don't need to clone from Heroku since your master branch locally and on github should be what is presently live on Heroku and then you should be working in a branch that is merged into master to go live.
This means I can be working on any computer and have the same code in front of me and just need to bundle/migrate my projects to be up and running but there's no reason why you can't just have the project setup and pull from github at which ever computer you're add and provided you add the heroku remotes on both computers you'll be fine.