如何将现有的heroku应用程序拉到新位置进行开发?

aar*_*ona 57 pull heroku git-pull

我目前在我想开发的另一台计算机上有我最新版本的代码(家用电脑和笔记本电脑,当我外出时)我在笔记本电脑上为我的应用程序设置了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
Run Code Online (Sandbox Code Playgroud)

我不能这样做heroku create因为那将创建一个单独的应用程序.如何将现有代码与heroku相关联(或从中拉下全新版本)?

什么命令这样做?

Gay*_*yle 112

另外,如果你以前从未在另一台机器上使用过heroku,那么你首先需要做一些事情:

$ gem install heroku
$ heroku login
 [then enter your credentials] 
$ heroku keys:add [path to keyfile]

现在您可以克隆远程存储库:

$ git clone git@heroku.com:<heroku_app>.git <local_directory>

  • 我认为这是更正确的方法:https://devcenter.heroku.com/articles/clone-heroku-app (4认同)

ogo*_*erg 48

首先,您需要按照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


drj*_*nco 5

如果您首先需要从 Heroku 获取应用程序,请克隆您的应用程序。

为此,请在终端中写入:

heroku git:clone -a your_app_name
Run Code Online (Sandbox Code Playgroud)

如果您已经拥有该应用程序和 heroku 的遥控器,请按照以下步骤操作。如果没有,您可以在此处查看说明https://devcenter.heroku.com/articles/git

  1. 找到你的数据库名称

在你的终端中写入:

heroku pg:info -a your_app_name
Run Code Online (Sandbox Code Playgroud)

它看起来像这样:

HEROKU_POSTGRESQL_MAROON_URL
Run Code Online (Sandbox Code Playgroud)
  1. 查找本地数据库的名称

在 Rails 应用程序中,转到config/database.yml

它看起来像这样:

your_app_name_development
Run Code Online (Sandbox Code Playgroud)
  1. 克隆您的生产数据库 (PostgreSQL)

在终端中写入您自己的数据库名称:

heroku pg:pull HEROKU_POSTGRESQL_MAROON_URL your_app_name_development -a your_app_name
Run Code Online (Sandbox Code Playgroud)

HEROKU_POSTGRESQL_MAROON_URL是生产数据库名称(在 Heroku 中)的示例: my_app_name_development是开发数据库的名称(本地) the_name_of_my_app是应用程序在Heroku中的名称

不要忘记通过捆绑安装来完成此操作...