Skip to content

Instantly share code, notes, and snippets.

@joelrojo
Created August 22, 2016 16:23
Show Gist options
  • Save joelrojo/e152fd2390fe710be8458923d83d68ca to your computer and use it in GitHub Desktop.
Save joelrojo/e152fd2390fe710be8458923d83d68ca to your computer and use it in GitHub Desktop.
SSH + Heroku tips

SSH

What is SSH?

Generating keys and attaching them to your accounts

cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
pbcopy < ~/.ssh/id_rsa.pub
# then add to your relative account

Multiple keys for multiple hosts (GitHub, BitBucket, Heroku etc)

  • Detailed article here
  • Note that keys can be any name, not just "id_rsa". You just have to configure it in your ssh/config like below.
ssh-keygen -t rsa -f ~/.ssh/accountB -C "[email protected]"
subl ~/.ssh/config

# contents of config file
Host bitbucket.org
  User git
  Hostname bitbucket.org
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa

Host bitbucket-accountB
  User git
  Hostname bitbucket.org
  PreferredAuthentications publickey
  IdentitiesOnly yes
  IdentityFile ~/.ssh/accountB

Config for sshing into server

subl ~/.ssh/config

# config file
Host ym 96.126.126.41
HostName 96.126.126.41
ForwardAgent yes
User joel

Host ipyxel 52.0.236.46
HostName 52.0.236.46
IdentityFile ~/.ssh/ipyxel.pem
User wpdev

Heroku

Deploying

heroku run YOUR COMMAND
# heroku run rake db:migrate
# these can be custom commands

# for configuring environment variables
heroku config:add

Heroku logs

heroku logs
# 100 lines by default

heroku logs -n 200
# 1500 maximum

Add ons

These are all FREE options from Heroku. You can find more here.

Other Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment