Wednesday, June 5, 2013

Deploying Rail with Heroku

One of my task this week is to learn Rails so I can build a web based Tic Tac Toe game. I followed the Ruby on Rails Tutorial but I was having trouble deploying my application on Heroku (i.e. section 1.4.2 in the book). Whenever I tried to do this:
git push heroku master
I get this:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

To solve this problem, I read how to manage your keys. I can't say I have the right answer, but this works for me.
  1. Make sure you have only one public key on Heroku (I'm not saying 2+ won't work. I'm saying it didn't work for me.) I'm doing this all in the command line.
    1. Type "heroku keys" to see what keys Heroku has for your profile
    2. Type "heroku keys:remove key_name" to remove the key you don't want
  2. Make sure the key you have is the same key on github
    1. To add the key "heroku add ~/.ssh/key_name.pub"

Note: You may need to login to heroku to do this. In order to log in, type "heroku login" then type your credentials.

If all that doesn't work, try to create a config file in your ssh folder. Your config file should look like this:
Host heroku.com
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/your_key_name
TCPKeepAlive yes
User your_email
Resource:
  1. Managing your keys in Heroku
  2. Stackoverflow answer

0 comments:

Post a Comment