How can I pull an existing heroku app to new location for development?

前端 未结 5 1846
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 05:24

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

相关标签:
5条回答
  • 2020-12-02 05:51

    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

    0 讨论(0)
  • 2020-12-02 05:56

    Also, If you've never used heroku before on the other machine, you'll need to do a few more things first:

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

    Now you can clone the remote repository:

    $ git clone git@heroku.com:<heroku_app>.git <local_directory>
    0 讨论(0)
  • 2020-12-02 06:03

    Once you create a key in a new computer, you have to upload your new SSH key by typing heroku keys:add.

    0 讨论(0)
  • 2020-12-02 06:04

    If you first need to get the app from Heroku, clone your app.

    To do that, write in your Terminal:

    heroku git:clone -a your_app_name
    

    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

    1. Find the name of your database

    Write in your Terminal:

    heroku pg:info -a your_app_name
    

    it will look something like this:

    HEROKU_POSTGRESQL_MAROON_URL
    
    1. Find the name of your local database

    In your Rails app go to config/database.yml

    it will look something like this:

    your_app_name_development
    
    1. Clone your production database (PostgreSQL)

    Write in your Terminal with your own database names:

    heroku pg:pull HEROKU_POSTGRESQL_MAROON_URL your_app_name_development -a your_app_name
    

    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...

    0 讨论(0)
  • 2020-12-02 06:10

    If you already have your code base ready and have heroku setup, use:

    $ heroku git:remote -a your_heroku_app
    

    This will allow you to deploy from your new location. Reference: https://devcenter.heroku.com/articles/git#creating-a-heroku-remote

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