Last Updated: February 25, 2016
·
930
· joelazemar

Create account and stack on heroku best pratices

Account

Login with your personal heroku account

cd ~/<name of my project>

and

heroku accounts:add <name of my project> --auto

Output

Enter your Heroku credentials.
Email: <your heroku email>
Password (typing will be hidden): 

Add the following to your ~/.ssh/config

Host heroku.<name of my project>
    HostName heroku.com
    IdentityFile /PATH/TO/PRIVATE/KEY
    IdentitiesOnly yes

Create keys

ssh-keygen

Add prefix on keys '<name of my project>_'

~/.ssh/<name of my project>_id_rsa
~/.ssh/<name of my project>_id_rsa.pub

Changes file ~/.ssh/config

Host heroku.<name of my project>
    HostName heroku.com
    IdentityFile ~/.ssh/<name of my project>_id_rsa
    IdentitiesOnly yes

Define user

heroku accounts:set <name of my project>

Add keys

ssh-add ~/.ssh/<name of my project>_id_rsa
heroku keys:add ~/.ssh/<name of my project>_id_rsa.pub

Create stack

heroku create --remote production <name of my project>-prod --stack cedar

Your new remote

git remote -v

production  git@heroku.com:<name of my project>-prod.git (push)
production  git@heroku.com:<name of my project>-prod.git (fetch)    

Changes git config

vi .git/config

[remote "production"]
    url = git@heroku.<name of my project>:<name of my project>-prod.git
    fetch = +refs/heads/*:refs/remotes/production/*

Push your code au heroku

git push production master:master -f

Yeah !

1 Response
Add your response

This is perfect. Where did you get the information to use this?

over 1 year ago ·