Search code examples
ruby-on-railsrubyherokusshkey-generator

heroku rails - all commands give "No account specified"


[Note: this is not about using --app appName, that's a different issue]

Due to doing both work and personal github projects my machine has got its git/heroku setting mixed up. I'm trying to just back to defaults but can't find all the 'artifacts'.

Trying to do commands such as

heroku keys
heroku keys:add
heroku keys:clear

even trying to add my key again!

heroku keys:add --app blazing-planet-3592

are all giving me

durrantm.../linker$ heroku keys:clear
Removing all SSH keys... failed
 !    No account specified.
 !    
 !    Run this command with --account <account name>
 !    
 !    You can also add it as a git config attribute with:
 !      git config heroku.account work

I recently installed heroku account to manage multiple accounts.


Solution

  • The key to my problems was that I needed to add --account personal to each command that I use in order to reference the file ~/.heroku/account/personal (that I created when I started using heroku 'accounts' functionality) which has my info as in:

    $ cat ~/.ssh/accounts/personal
    :username: m2@snap2web.com
    :password: b1951...868b6
    

    so my commands just need to be:

    $ heroku keys --account personal
    $ heroku keys:add --account personal
    $ heroku keys:clear --account personal
    $ heroku keys:add --app blazing-planet-3592 --account personal
    

    I also subsequently ran heroku account:add work and then put in my WORK credentials (email & pw when prompted) for the (different) account that I use for work.

    It told me to add stuff to my .ssh/config file -

    Add the following to your ~/.ssh/config

    Host heroku.work
      HostName heroku.com
      IdentityFile /PATH/TO/PRIVATE/KEY
      IdentitiesOnly yes
    

    but I'm leaving that undone for now (would welcome suggestions about options for that, when it's needed, etc.).