Multiple accounts heroku keys mixed up - heroku

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.

Related

Don't have access to Heroku app

I have a mystery app in Heroku. It's called weird-app-5536
When I try to push my code to Heroku I get this message:
Your account my_email#geemail.com does not have access to weird-app-5536.
!
! SSH Key Fingerprint: *************************************************
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I try...
heroku apps
I get a list of my apps, but it does not include the mystery app, weird-app-5536.
I can't destroy or rename the weird-app-5536 app. It always says I don't have access.
The app does not appear on my list of apps on the Heroku website.
When I type
git remote -v
I get this:
heroku git#heroku.com:weird-app-5536.git (fetch)
heroku git#heroku.com:weird-app-5536.git (push)
origin git#github.com:thisisme/my_code.git (fetch)
origin git#github.com:thisisme/my_code.git (push)
I deleted my old ssh keys. I created a new one and added it to Heroku
I can create new apps and they show up on my list of apps.
As far as I know I only have one Heroku account.
Stumped. I don't know where to go from here.
What's happened is the git repo on which you're working is tied to an old remote. No need to contact heroku or anything... Just remove the heroku git remote and readd it.
Remove by running:
git remote rm heroku
Readd with:
heroku git:remote -a appname
More here: https://devcenter.heroku.com/articles/git
Honestly, I would try to get a hold of Heroku support. It might be possible that you were listed as a contributor to another app by someone but weren't given write access? Heroku support is probably your best bet.

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.

Heroku: could not read from remote repository

I created an app and got on Heroku, everything worked fine until I had to format the computer.
I had to update the app and I can not synchronize the folders.
I Heroku Keys and saw that it appeared the network name before formatting, so I removed with heroku Keys: remove ... and added a new key with ssh-keygen-t rsa.
I also entered the git file and delete the lines in "heroku remote", but neither worked. After much testing I realized that in the same file in the fetch line did not appear the name of the app, instead put heroku, I changed it, but still not working.
I always show the same errors, although I already created a SSH public key: public key C :/ / .ssh / id-rsa.pub
permission denied (publickey)
fatal: Could not read from remote repository
Please make sure You have the correct access rights and the repository exists
Even I created a new app, but appear the same mistakes, it is clear that the problem is due to formatting the computer, something does not match and does not let me sync files in any app.
It sounds like Heroku is missing your SSH public key, you just need to add it using this command:
$ heroku keys:add
If you need to generate new SSH keys too, this article covers both of these topics.

git push heroku master Permission denied (publickey)

Edit #3
Updating this at the top because it solved my issue and gave me a good troubleshooting step I didn't know about (and could save you some time, too)
Try getting the output of ssh -vvv git#heroku.com. For me, ssh was getting hung up on trying keys in /c/Program Files (x86)/Emacs/.ssh when my public key was in /c/Users/NumberOverZero/.ssh
Deleting the Emacs ssh folder (which was empty) fixed my issue since ssh would then check my Users .ssh folder.
I'm getting Permission denied (publickey) when trying to git push heroku master.
A few things that makes this different from the posts below:
I have ssh working for github
I was able to successfully push to heroku last night
Since that push, I've made a single-line change to one js file, and committed and pushed. There have been no other changes.
The closest I could find was this post:
git clone heroku ssh permission denied
I've looked through the related issues (there's quite a few):
git push heroku master Permission denied (publickey). fatal: The remote end hung up unexpectedly
git push heroku master permission denied
git clone heroku ssh permission denied
https://stackoverflow.com/questions/13059076/git-push-permission-denied-publickey-windows-xp
heroku - rails - Permission denied (publickey)
I've tried:
heroku keys:clear
heroku keys:add
heroku keys:clear
*delete every key in .ssh*
heroku keys:add
*delete my application on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
delete keys in .ssh
heroku keys:clear
copy all files into a new repository
push new repository to github successfully
heroku login (adds github key for me)
heroku create
git push heroku master
fails
*delete the app on heroku*
heroku keys:clear
heroku login (adds key for me)
heroku create
heroku git:clone app app
fails
Any ideas? I've gone through all of the steps in the linked SOs - most of which were just people not running heroku:add or setting up ssh keys (which I've done in each of these).
I let heroku take the wheel most of the time, (instead of directly creating ssh keys) assuming that the built-in commands would do what they needed when there were no ssh keys present. It seems not.
EDIT: And now that I deleted the app, the new relic addon is alarming that the website is down. Trying to log in through their website asks me to log in through heroku. Which I can't find a way to do, since the app is gone. Is there a way to delete that addon now that I can't get to the app? heroku addons gives an error, so I don't think I'm getting to it through there.
EDIT #2: Added another step I tried - moved files into new repository and push to new application.
I had the same problem for Windows 7 box and found the solution here: http://www.gmarwaha.com/blog/2011/05/18/heroku-trouble-with-windows-and-ssh-keys/
Solution: Typically once you create the keys as mentioned above, two files – “id_rsa” and “id_rsa.pub” – are stored in the “.ssh” folder
within the user’s home folder. If you are working with linux that
seems to be good enough. But for the windows version of git that
doesn’t seem to cut it. It wants the keys to be stored inside the
“.ssh” folder within the “msysgit” installation folder as well. If you
don’t find a “.ssh” folder inside the “msysgit” installation folder,
feel free to create one. Once you drop these two key files there and
repeat the entire process, everything went as smooth and my
application got deployed in the heroku cloud and the world is again a
better place to live in.
In my case, I have to find where git.exe was installed, which is C:\Program Files\Git\. So here are the steps:
Create .ssh folder inside C:\Program Files\Git\
Copy id_rsa and id_rsa.pub from your home folder (C:\Users\username\.ssh\) to C:\Program Files\Git\.ssh\.
Try again with C:\dev\heroku\sample-app> git push heroku master.
Nice job linking to all the other things you've looked at and tried! (that will improve the responses you get, but still you should be prepared for a lot of 'have you tried...', and 'maybe it's ...' because this is a system/env issue that isn't on the normal flow)
You might have had something working in your local terminal session that has since been lost. (I've had this happen a bunch of times)
Things it might be:
your ssh keys on heroku
your ability to push up to heroku from that computer/network
something about your git repo
I ran into this once and it was driving me crazy. I hopped on my (FREE) cloud9 account, cloned some simple rails app from github and pushed it out to heroku, which helped me prove that my heroku account was fine, heroku itself was fine, but my local laptop had some issues in my configuration.
I think the issue was my username, but I don't remember. (moving to a different env and starting from scratch helped me realize the issue though)
The main reason you get this message is because you do not have ssh-keygen added to your environment variables.
This command is located in the bin-directory of Git program files.
You should add that bin directory to your environment variables.

ssh key fingerprint error when trying to switch heroku accounts

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.

Resources