breaking into the unknown…

fatal: The remote end hung up unexpectedly in heroku

Leave a comment

I have explained deploying rails app on heroku in this post. I get into below error while trying to push the code on HEROKU.

$ git push heroku master # command to push code to heroku, got below error message on console
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

From the message, we can see that, there is some problem with the publickey. public key of your system should be present in your HEROKU account.

This key get added when you try to login to heroku from you development machine for the first time as below
$ heroku login
Enter your Heroku credentials.
Password (typing will be hidden): **************
Could not find an existing public key.
Would you like to generate one? [Yn]
Generating new SSH public key.
Uploading ssh public key /Users/adam/.ssh/

just press enter, the public key is needed to push your code later on. Here, new public key is created and uploaded to your heroku account. But in my case, since my system already have the public key, my terminal log look like below.

$ heroku login
Enter your Heroku credentials.
Password (typing will be hidden): **************
Authentication successful.

PEOBLEM : In my case , since I already have the public key, but is not uploaded to my HEROKU account, so Iam getting the above error

SOLUTION : upload your public key to your HEROKU account

It can be done with below command:
$ heroku keys:add # it will upload your key as you can see in the terminal message
Found existing public key: /home/arun/.ssh/
Uploading SSH public key /home/arun/.ssh/… done

If you are not aware of certain HEROKU command you can get the detail with below step. Infact, I do not know myself the command to add the keys but get it with the below steps.

$ heroku # it will list all availabe command
Usage: heroku COMMAND [–app APP] [command-specific-options]

Primary help topics, type “heroku help TOPIC” for more details:

  addons    #  manage addon resources
  apps      #  manage apps (create, destroy)
  auth      #  authentication (login, logout)
  config    #  manage app config vars
  domains   #  manage custom domains
  logs      #  display logs for an app
  ps        #  manage processes (dynos, workers)
  releases  #  manage app releases
  run       #  run one-off commands (console, rake)
  sharing   #  manage collaborators on an app

Additional topics:

  account      #  manage heroku account options
  certs        #  manage ssl endpoints for an app
  db           #  manage the database for an app
  drains       #  display syslog drains for an app
  fork         #  clone an existing app
  git          #  manage git for apps
  help         #  list commands and display help
  keys         #  manage authentication keys
  labs         #  manage optional features
  maintenance  #  manage maintenance mode for an app
  pg           #  manage heroku-postgresql databases
  pgbackups    #  manage backups of heroku postgresql databases
  plugins      #  manage plugins to the heroku gem
  stack        #  manage the stack for an app
  status       #  check status of heroku platform
  update       #  update the heroku client
  version      #  display version
Now to know about any of the command say key we can get further detail as below with –help option:

$ heroku keys –help # it will tell you all options available for keys and how to use them
Usage: heroku keys

display keys for the current user

 -l, –long  # display extended information for each key

Additional commands, type “heroku help COMMAND” for more details:

keys:add [KEY]   #  add a key for the current user
  keys:clear       #  remove all authentication keys from the current user
keys:remove KEY  #  remove a key from the current user

Author: arunyadav4u

over 7 years experience in web development with Ruby on Rails.Involved in all stage of development lifecycle : requirement gathering, planing, coding, deployment & Knowledge transfer. I can adept to any situation, mixup very easily with people & can be a great friend.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s