Checking the current status of things

Typing heroku apps:info can give you a lot of information about the app you are currently working with.

$ heroku apps:info
=== salty-reef-52860
Git URL:
Region:        us
Repo Size:     0 B
Slug Size:     0 B
Stack:         cedar-14
Web URL:

Setting the heroku remote

Suppose you try to do git push heroku master and you get this error message:

$ git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The problem here is that you don’t have the remote heroku set up in this particular app.

There are two possible solutions:

  1. Find the heroku app you’ve already created, and link this app to that repo.
  2. Use heroku create to create a new heroku app.

Solution 1: Find the heroku app you’ve already created:

You can list all of your current heroku apps in one of two ways:

When you find the name of your app, such as flowery-poo-23456, you can use the following command to link it to your currently cloned repo:

$ heroku git:remote -a flowery-poo-23456
set git remote heroku to

This will link the github remote heroku to your heroku app. Then git push heroku master will work just fine.

Solution 2: Create a new heroku app

Type one of the following:

This will create a new app, and link your app to it. Then git push heroku master will work just fine.

A trick to set up Heroku config vars easily

If you are working with OAuth, Sessions, a Database, or an API Key, you may have set up an file to store credentials locally. The file is typically in your .gitignore so that the confidential credentials don’t end up being stored, accidentally, in a github repo.

At some point, if you want to run that app on Heroku, you’ll have to set up all those variables on the config vars screen. That’s really tedious. Here’s a shortcut.

Make the following script, called Just use any editor (could be idle or could be another one like gedit to create the file.)


It will copy all of the settings from your local environment into the Heroku config vars.

#!/usr/bin/env bash

echo "Copying your local settings to heroku"
echo "You should have run . before running this script"
echo ""
echo "ALSO NOTE: OAuth CLIENT_ID and CLIENT_SECRET may need to be different for heroku"

heroku config:set  GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}   
heroku config:set  APP_SECRET_KEY=${APP_SECRET_KEY}
heroku config:set  GITHUB_ORG=${GITHUB_ORG}

heroku config:set  MONGO_HOST=${MONGO_HOST}    
heroku config:set  MONGO_PORT=${MONGO_PORT}
heroku config:set  MONGO_DBNAME=${MONGO_DBNAME}

Note that for any OAuth credentials, if those credentials work locally, they are tied to a address for the homepage and callback urls.

You’ll either have to: