Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku: account does not have access to app

I'm trying to git pull heroku master, but I'm getting

 !  Your account [email protected] does not have access to app_name.
 !  
 !  SSH Key Fingerprint: 30:02:49:32...

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have done heroku login and been authenticated successfully. I need to switch account's but not sure what else I need to do besides heroku login.

like image 225
hellomello Avatar asked Dec 15 '22 20:12

hellomello


1 Answers

Try all of the helpful answers found here.

For me, I had two different heroku accounts, each associated with a different git repository. So I had to tell heroku to use specific SSH key for each one (apparently, not just the first available one, which seems to be the default behavior). The exact method that worked for me was following the steps here and then here.

The details:

Create a new rsa key: Specify any email you want and choose a name that will be easy for you to remember and associate with the specific heroku app. Or you could name it something like /id_rsa_herokualt.

$ ssh-keygen -t rsa -C "youremail[at]domain.com" -f  ~/.ssh/id_rsa_myherokuapp

Add to your machine: Make sure to type in the exact file name as you just specified it in the last step.

$ ssh-add ~/.ssh/id_rsa_myherokuapp

Add to Heroku: This assumes you have already logged into heroku using heroku login.

$ heroku keys:add ~/.ssh/id_rsa_myherokuapp.pub

Add an alternate host for heroku.com to your ~/.ssh/config. Locate this file by going to Finder and pressing command + shift + g and typing in ~/.ssh/. Open the Config file in a text editor, add the following text, and then save it:

Host heroku-alt
HostName heroku.com
IdentityFile ~/.ssh/id_rsa_myherokuapp

Update the .git/config in your project to use the host alias. Locate this file by going to Finder and pressing command + shift + g and typing in ~/path/to/your/repository/.git. Open the Config file in a text editor, add the following text, and then save it:

[remote "heroku"]
  url = git@heroku-alt:myherokuapp.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

Explanation: By choosing between heroku and heroku-alt in the remote of the .git/config files of specific projects you can manage which projects use which credentials.

like image 170
andrewborstein Avatar answered Dec 29 '22 19:12

andrewborstein