ssh key fingerprint error when trying to switch heroku accounts - heroku

i often need to switch heroku accounts and use a script which does the following:
heroku keys:clear && rm ~/.heroku/credentials && heroku list
after which i need to enter my credentials for the account i want to switch to:
Enter your Heroku credentials.
Email: fake#gmail.com
Password:
Uploading ssh public key /Users/fake/.ssh/id_rsa.pub
! Fingerprint already exists. Please use one ssh key per Heroku account
unfortunatelly i canĀ“t get passed this error.
any help much appreciated.

remove the heroku credentials
rm ~/.heroku/credentials
And then upload the key manually
heroku keys:add ~/.ssh/otheraccount.pub
Enter your Heroku credentials and thats it!!

Dont use the same ssh key for mutiple accounts. Please use one ssh key for one account.
For more info to fix this problem you can refer to http://martyhaught.com/articles/2010/12/14/managing-multiple-heroku-accounts/

strangely enough i could solve the problem with:
clearing the keys, deleting credentials switching to other accounts and back again.

Related

Multiple accounts heroku keys mixed up

I have multiple accounts on heroku and I think my ssh keys got messed up but I have no idea how to fix it.
When i try 'git push heroku master' i get the error 'your account ***** does not have access to *****'
How do I fix my keys so that I can push to heroku?
Heroku wont allow to share ssh key between 2 heroku accounts.
I will help you to get through this by a hacky fix
1.First go to .ssh/ directory in your home folder
2.Move all the files and keep it in any other folder(Don't delete it)
3.Open the terminal and Login to heroku using "heroku login" command and login to your heroku account which you want to push now.
4.After sucessfully logging in to your account enter "heroku keys:add" command. it will create a new ssh keys for your account. you can now push to your account easily.
Suppose if you want to push to any application using your old account replace the .ssh/ folder files to backuped files. (Backup your current .ssh/ to any folder)
or you can repeat same step 1-4 for that account.
I hope this will solve your problem.

Authentication failure in Heroku CLI after password change

After a password change on heroku's website, I can't access the heroku api.
When I do heroku login, I get Authentication successful, even though it shouldn't because the password has changed. It doesn't even ask for my email or password, like it should!
If I try heroku apps (or any other application related command), I get Authentication failure.
If I try heroku status, it works.
I don't have any plugins installed.
Logs:
$ heroku version
heroku-gem/3.6.0 (i686-linux) ruby/2.1.0
$ heroku logout
Local credentials cleared.
$ heroku login
Authentication successful.
$ heroku apps
Authentication failure
$ heroku plugins
You have no installed plugins.
I'll appreciate any help or ideas I can get. I already opened a ticket and waiting for the Heroku Support to get back to me.
Thanks
After a password change on heroku's website, I can't access the heroku api.
Are you using the heroku-accounts plugin? If so, try uninstalling it.
heroku plugins:uninstall heroku-accounts
rm -r ~/.heroku/accounts
heroku logout
heroku login
https://github.com/ddollar/heroku-accounts/issues/56
Apparently, changing the password for heroku regenerates a new API key, and I had the wrong HEROKU_API_KEY configured. (It regenerates a new one after password change).
I'm posting here the response from the great Heroku's support team, which gave me these suggestions:
Is there a ~/.netrc file on your computer? If there is, can you please check if the file contains something Heroku related things? Please remove if there is, and try login again.
Is there an HEROKU_API_KEY environment variable defined on your machine? If yes, could you remove it and login try again?
Is there a ~/.heroku/credentials file (with or without an extension) on your machine? If yes, could you remove it and try login again?
Finally, if none of those work, could try the following command: GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' heroku login and see how it goes?
Are you using the heroku-accounts plugin? If so, try uninstalling it.
You may not need to uninstall it...
Make sure you are not in a project directory (or you may run into the "account not found" loop).
cd
List your accounts.
heroku accounts
On each account where the password was changed
heroku accounts:remove ACCOUNT
heroku accounts:add ACCOUNT
(I did not need to do anything with the ~/.ssh/config.)
Reset your default account, if needed.
heroku accounts:default ACCOUNT
If you changed the account name or git config --unset heroku.account.
cd /path/to/your/project
git config --add heroku.account ACCOUNT
I didn't want to give up on the heroku-accounts plugin. :)
heroku accounts:remove personal or whatever account name you have
git config --unset heroku.account
heroku accounts:add personal then login
In my case, I had multiple heroku accounts managed by heroku-accounts gem and authentication started failing after I changed one of my account's password.
Steps I followed to make things normal again:
Removed the account (that's failing to authenticate) from heroku accounts:
heroku accounts:remove account_name
Opened up a new terminal and then added the account again that I just deleted:
heroku accounts:add account_name --auto
Here you have to use your new credentials.
That's it. Problem solved.
Try deleting ~/.netrc (this is where the Heroku CLI tool saves the auth tokens) and starting over.

managing multiple ssh keys on heroku

so I have a couple of ssh keys that are used for other accounts that I have. I now need to be able to clone a heroku repository on my computer. I created a new ssh key and used heroku keys:add to add it to my heroku account. However when I try and clone the repository I get this error:
Your key with fingerprint: .... is not authorized to access rural-visions. fatal: the remote end hung up unexpectedly
I've heard that I need to create a config file in the .ssh folder, but I don't know what to put into there.
Any help would be really appreciated!
I sometimes have to work with a bunch of heroku accounts, and have run into this. Here's what I usually do:
Clear identities
$ ssh-add -D
ssh-add the key that I need for the current account
$ ssh-add ~/.ssh/an_account_key
Now I can push to my heroku app
$ git push heroku-remote master
Of course, this assumes that the key has been added to the heroku account already. You can do that with:
$ heroku keys:add
The correct way to solve this is with an SSH configuration in ~/.ssh/config, but that's a bit much for me since I only switch accounts occasionally.
Googling about the SSH configuration file should turn up plenty of results, but here's some that might help:
SSH config - same host but different keys and usernames
Specify an SSH key for git push for a given domain
Simplify Your Life With an SSH Config File

newly added key causing not authorized error

I've created a new ssh key, added it to my ssh keys locally, then added it to heroku. When I try to push, I get a 'not authorized' error. I'm not sure what to do next...
~/app> heroku keys:add /home/user/.ssh/XXX-YYY-ZZZ.pub
Uploading SSH public key /home/user/.ssh/XXX-YYY-ZZZ.pub... done
~/app> heroku keys
=== mail+heroku#mydomain.com Keys
ssh-rsa xxxx zzz#ubuntu
ssh-rsa yyyy zzz#ubuntu
~/app> ssh-add /home/user/.ssh/XXX-YYY-ZZZ
\Enter passphrase for /home/user/.ssh/XXX-YYY-ZZZ:
Identity added: /home/user/.ssh/XXX-YYY-ZZZ (/home/user/.ssh/XXX-YYY-ZZZ)
~/app> git push heroku master
! Your key with fingerprint XXXXX is not authorized to access XXX-YYY-ZZZ.
fatal: The remote end hung up unexpectedly
Do I have to connect that key to my XXX-YYY-ZZZ app somehow? I don't see anything about that in the docs here https://devcenter.heroku.com/articles/keys.
May be related, I have two heroku accts that I'm deploying to, this one that's failing is the second one. I'd like to keep them separate. I suspect the issue is with my ssh_config but I'm not sure how to solve it yet.
Looks like there's a plugin for heroku that will deal with this:
https://github.com/ddollar/heroku-accounts

Heroku No Such Account Error

To start:
I am able to log in to heroku with my email and password.
When logging into heroku through my terminal using the same email and password credentials I get the following error.
heroku login
Email: myemail#email.com
Password:
No such account: myemail#email.com
check your [Project Root]/.git/config
There are some heroku accounts specific settings:
[heroku]
account = <account name>
you can delete those two lines and then try to login again
Just save what you delete :)
Try to remove the existing account credentials rm -rf ~/.heroku/plugins/heroku-accounts and do heroku login enter your credentials
Try making sure you have the latest version of the heroku gem/toolbelt installed.
Check your .git/config for references to remotes like 'git#heroku.account' and remove those.
Also, check your ~/.ssh/config for references to that 'account' and take them out.
Then, re-do your auth heroku auth:logout and heroku auth:login and maybe heroku keys:add to get everything set back up.
I think the problem is a conflict between Heroku toolbelt and the Heroku gem. I also had the same problem. Read this article to solve it - http://bit.ly/1sku20D

Resources