如何将现有的heroku应用程序拉到新位置进行开发?
目前,我在另一台计算机上有最新版本的代码,我想用它来开发(家用计算机和笔记本电脑,供我外出时使用),我在笔记本电脑上为我的应用程序设置了heroku。现在我需要将我的代码关联到桌面上,以便我也可以从那里推送到 heroku。
这是我从桌面上得到的结果:
desktop:~/NetBeansProjects/onlinescheduler$ git pull heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
我无法执行 heroku create
因为这将创建一个单独的应用程序。如何将现有代码与heroku关联(或从中下载全新版本)?
执行此操作的命令是什么?
I currently have the latest version of my code on another computer that I want to develop from (Home computer and laptop for when I'm out and about) I set up heroku for my app on my laptop. Now I need to associate my code on my desktop so that I can push to heroku from there as well.
This is what I get from my desktop:
desktop:~/NetBeansProjects/onlinescheduler$ git pull heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
I can't do heroku create
because that will create a separate app. How do I associated the existing code with (or pull down a brand new version from) heroku?
Whats the command to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
另外,如果您以前从未在另一台计算机上使用过 heroku,则需要先执行更多操作:
现在您可以克隆远程存储库:
Also, If you've never used heroku before on the other machine, you'll need to do a few more things first:
Now you can clone the remote repository:
首先,您需要遵循 Heroku 的快速入门说明,您可以直接从马口中获得该说明,就在这里:https://devcenter.heroku.com/articles/quickstart
完成第 3 步后,请返回此处。
然后,您可以在命令行中输入:
heroku git:clone -a myapp
这里描述了:
https://devcenter.heroku.com/articles/git-clone-heroku-app
然后,如果您也想获取数据库,这里有一些选项。
有关导入/导出的较新 Heroku 说明:
https://devcenter.heroku.com/articles/heroku-postgres-import-export
有关推拉的旧版 Heroku 说明: https://blog.heroku .com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku
如果您使用 mongo,这是同步 mongo 数据库的有用工具:https://github.com/pedro/heroku-mongo-sync#readme
First of all, you'll want to follow the Quick Start instructions for Heroku, which you can get straight from the horse's mouth, right here: https://devcenter.heroku.com/articles/quickstart
Once you've gotten through step 3, come back here.
Then, you can type this into the command line:
heroku git:clone -a myapp
This is described here:
https://devcenter.heroku.com/articles/git-clone-heroku-app
Then, if you want to grab the database too, here are some options.
Newer Heroku instructions on import/export:
https://devcenter.heroku.com/articles/heroku-postgres-import-export
Older heroku instructions on push and pull: https://blog.heroku.com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku
If you are using mongo, this is a useful tool to sync your mongo database: https://github.com/pedro/heroku-mongo-sync#readme
如果您首先需要从 Heroku 获取应用程序,请克隆您的应用程序。
为此,请在终端中写入:
如果您已经拥有该应用程序和 heroku 的遥控器,请按照以下步骤操作。如果没有,您可以在此处查看说明 https://devcenter.heroku.com/articles/git
在终端中写入:
它将看起来像这样:
在 Rails 应用程序中,转到 config/database.yml
它将看起来像这样:
在终端中写入您自己的数据库名称:
HEROKU_POSTGRESQL_MAROON_URL 是生产数据库名称的示例(在 Heroku 中):
my_app_name_development 是您的开发数据库的名称(本地)
the_name_of_my_app 是您的应用程序在 Heroku 中的名称,
不要忘记通过捆绑安装来完成此操作...
If you first need to get the app from Heroku, clone your app.
To do that, write in your Terminal:
If you already have the app and the remote to heroku follow the next steps. If not, you can check instructions here https://devcenter.heroku.com/articles/git
Write in your Terminal:
it will look something like this:
In your Rails app go to config/database.yml
it will look something like this:
Write in your Terminal with your own database names:
HEROKU_POSTGRESQL_MAROON_URL is an example of how could be the name of your production database (in Heroku):
my_app_name_development is the name of your development database (locally)
the_name_of_my_app is the name of your app in Heroku
Don't forget to finish this with bundle install...
如果您已经准备好代码库并设置了heroku,请使用:
这将允许您从新位置进行部署。
参考: https://devcenter.heroku.com/articles/git#creating -a-heroku-remote
If you already have your code base ready and have heroku setup, use:
This will allow you to deploy from your new location.
Reference: https://devcenter.heroku.com/articles/git#creating-a-heroku-remote
在新计算机中创建密钥后,您必须通过输入
heroku keys:add
上传新的 SSH 密钥。Once you create a key in a new computer, you have to upload your new SSH key by typing
heroku keys:add
.