I can't choose in which heroku remote push my app - ruby-on-rails

I add a heroku app called 'myapp-production'. I could push in this remote via git push heroku master. Fine.
I created a second app on heroku called 'myapp-staging', and add this remote via git remote add myapp-staging git#heroku.com:myapp-staging.git.
git push heroku master seems to correspond to myapp-production.
And when I try to git push myapp-staging, I have this error :
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
How can I fix it and ideally be able to git push myapp-staging master and git push myapp-production master ?
git remote -v gives :
myapp-staging git#heroku.com:myapp-staging.git (fetch)
myapp-staging git#heroku.com:myapp-staging.git (push)
heroku https://git.heroku.com/myapp-production.git (fetch)
heroku https://git.heroku.com/myapp-production.git (push)
origin git#github.com:johndoe/myapp.git (fetch)
origin git#github.com:johndoe/myapp.git (push)
Thank's in advance for your help.

Make sure your ssh public key typically ~/.ssh/id_rsa.pub is registered with heroku. You can check that at https://dashboard.heroku.com/account

Related

How to resolve this github/heroku conflict

I have an app on Heroku that I have had for a couple of years, but now I need to refactor some code and update some gems.
When I first started the app I was on a totally different machine. So I had to clone the github repo for that app.
Now I want to push the first changes but I get this error:
set git remote heroku to https://git.heroku.com/alfa-blog.git
I thought it was asking me to do something like this:
git remote add heroku https://git.heroku.com/alfa-blog.git
But I get this error:
fatal: remote heroku already exists.
How do I resolve this? If there is anything unclear, please let me know so I may clarify.
Do I delete the origin one?
heroku https://git.heroku.com/alfa-blog.git (fetch)
heroku https://git.heroku.com/alfa-blog.git (push)
origin https://github.com/<github-page>/Alpha_Blog.git (fetch)
origin https://github.com/<github-page>/Alpha_Blog.git (push)
Trying to rename remote repo:
$ git remote rename https://git.heroku.com/alfa-blog.git https://github.com/ldco2016/Alpha_Blog.git
fatal: No such remote: https://git.heroku.com/alfa-blog.git
You don't need to remove or rename anything, just set-url to the repo you are currently working in, like this:
git remote set-url origin https://github.com/<github-page>Alpha_Blog.git
Then you should be able to push your new changes to your existing app on Heroku.
Is the remote set to a different url right now? You could try removing it and then adding as you tried again.

Fatal: Heroku repository does not exist

I renamed my Heroku app from their goofy name to something more reasonable. I never imagined that it would cause me trouble here. just now I tried the following
git remote -v
heroku http://appname.herokuapp.com (fetch)
heroku http://appname.herokuapp.com (push)
origin git#github.com:MyAccount/games.git (fetch)
origin git#github.com:MyAccount/games.git (push)
I thought I had it won there. but then I tried
git push heroku master
and then i got this message
fatal: repository 'http://appname.herokuapp.com/' not found
I don't understand why it won't push
You need to change your heroku remote to match the new name for your app.
Do on the command line
git remote remove heroku
git remote add heroku git#heroku.com:YOUR_APP_NAME.git
Let me know if that doesn't fix it

Heroku with Multiple Domains

I have multiple heroku domains. After I created a new one, and I pushed, it checked the rsa for the first one.
How to handle this? Thanks.
203-96:first_app marklaudalauw$ heroku create
Creating serene-chamber-4301... done, stack is cedar
http://serene-chamber-4301.herokuapp.com/ | git#heroku.com:serene-chamber-4301.git
203-96:first_app marklaudalauw$ git push heroku master
! Your key with fingerprint 98:6b:fe:d4:e3:0a:17:16:ab:f8:11:18:a2:66:76:b6 is not authorized to access glacial-shelf-8147.
fatal: The remote end hung up unexpectedly
Before pushing Try this:-
$ git remote add heroku git#heroku.com:yourappname.git ( to add current stack )
$ heroku keys:add ~/.ssh/id_rsa.pub (if stuck with key then add local machine key to heroku)
$ git commit -m "message"
$ git push heroku master <branch name>
I managed to solve it by the following commands:
git remote rm heroku
git remote add heroku git#heroku.com:serene-chamber-4301.git
Thanks...

Can't push on heroku

I’ve just cloned one of my repositories on github, I've made some changes and I would like to send it on the heroku application. But when I try to run git push heroku master, I get :
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What can I do to solve it?
This is because there's no remote named heroku. You can see your remotes by typing git remote -v. For my 'example' app I see the following:
$ git remote -v
heroku git#heroku.com:example.git (fetch)
heroku git#heroku.com:example.git (push)
If it's missing, you can add the remote with the following command:
git remote add heroku git#heroku.com:example.git
where example is the name of your heroku app.
Before you can do
$ git push heroku master
you need to setup heroku by following the steps given at Getting Started with Heroku. Once you have setup heroku, logged in,created your app.
Verify that git remote is added
$ git remote -v
it should list a remote named heroku. if it does then the error heroku' does not appear to be a git repository will go away
If you have followed the steps in tutorial you just need to login in again:
cmd "heroke login"

How do I change the fetch and push actions targets for deploying heroku apps

Right now when I type git remote -v in the terminal when I am in my applications directory I get:
heroku git#heroku.com:falling-samurai-3043.git (fetch)
heroku git#heroku.com:falling-samurai-3043.git (push)
origin git#github.com:obsideous/sample_app.git (fetch)
origin git#github.com:obsideous/sample_app.git (push)
falling-smurai-3043 no longer exists because I destroyed it from my account on the heroku website. I would like it to look like:
heroku git#heroku.com:(one that I create).git (fetch)
heroku git#heroku.com:(one that I create).git (push)
origin git#github.com:BigBoy1337/sample_app.git (fetch)
origin git#github.com:BigBoy1337/sample_app.git (push)
obsideous is my old account and BigBoy1337 is my new GitHub account that I am trying to switch everything over to.
How can I accomplish these changes. I am a noob at this stuff so the more detailed the better. Thanks!
You can change the remote name by typing (git remote man page):
git remote set-url heroku git#heroku.com:(one that I create).git
git remote set-url origin git#github.com:BigBoy1337/sample_app.git
That will update both push and fetch addresses in your git config file.

Resources