To Setup Heroku on local machine we first need to add the heroku gem using,
gem install heroku
then we need to add heroku plugins using,
heroku plugins:install git://github.com/ddollar/heroku-accounts.git
we then need to add heroku account using,
heroku accounts:add project --auto
where "project" can be any name that’s meaningful to you, the name is only used locally.
We can add multiple heroku accounts using the above command, now we need to set
the newly created account using,
heroku accounts:set project
we can use the above command to switch between different accounts.
Now we need to create heroku which would add heroku as one of our git remote repositories using,
heroku create
we remove this newly created remote heroku repo since its currently not linked to any heroku projects using,
git remote rm heroku
and replace it with the heroku project we need to track using,
git remote add heroku git@heroku.com:example.git
where "example" is the name of your Heroku project.
Now the heroku project is linked to our local project and we can push our code to heroku using,
git push heroku master
The following are few additional command which would be useful for different process,
To check heroku configuration,
heroku config
To check heroku logs
heroku logs --tail
To run migrations on heroku,
heroku run rake db:migrate
To run heroku console,
heroku run console
To restart heroku,
heroku restart