Can run rake but not push to heroku - ruby-on-rails

I have a remote on heroku called staging. I can
heroku run rake db:version --remote staging
but if I try git push staging master
I receive the error message:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
However I can push to github e.g. git push origin master
What is the easiest way to fix this?

You will have to add your system public key to heroku ssh keys. You can copy .ssh/id_rsa.pub content and paste while adding ssh keys from Manage account > SSH keys > Edit.

Related

Heroku: Permission denied (publickey). fatal: Could not read from remote repository when doing git push

I've spent the day reviewing all the existing solutions suggested on Stackoverflow and elsewhere, and tried them without success, and I'm still stuck with this.
The "heroku keys:add" solution doesn't work for me, so please don't link me back to that one.
I'm on MacOSX Lion. Thanks
Heroku no longer needs to use the git protocol & Public/Private encryption keys, instead you can use the following command to use your Heroku API key
heroku login
This command creates (or updates) a ~/.netrc file with your Heroku API key.
Now, any Heroku remote repository can be pushed to via the https protocol, rather than the git (ssh) protocol.
Check the address of your Heroku repository for your project with:
git remote -v
If your git remote address for Heroku starts with https://git.heroku.com/... then you are good to push. If the remote address starts with git then you need to update the remote address for Heroku
git remote set-url heroku https://git.heroku.com/...
Check the Heroku dashboard Settings tab for your app for the full Git URL for that app
If you have already git initialized and heroku toolbet is completely installed , enter this command $ git remote -v it will initialize heroku git and you can push to it.
Whenever you run the command $ git remote -v , will create a git repo in app_name/.git/logs//refs/remote/heroku , first check whether your git been initialized for heroku or not, even I had the same problem and I've corrected.

Can't push to Heroku using git push heroku master (Could not read from remote repository)

I am trying to push my rails app to Heroku. When I attempt to push to heroku:
git push heroku master
I get the following error:
! Your account abc#abc.com does not have access to APPNAME
! SSH Key Fingerprint: 8b:ac:.......
fatal: Could not read from remote repository
Please make sure you have the correct access rights and the repository exists.
When I type:
heroku keys
I can see my ssh-rsa key.
What I have tried:
Clear all SSH keys (both heroku and gitHub). Create a new SSH key for GitHub and upload this same SSH key to both Heroku and Github
Opened GitBash and
ssh-add
ssh-add -l
To add and verify only one key:
Login to heroku website and verify only one key at SSH key field
I can push to GitHub fine but not to Heroku. Can anyone please help?
1) Firstly do the heroku keys:add and then try or copy your ssh key and paste it, on the account settings of heroku.
2) Secondly checking that ur this ssh key not be accessed by another heroku app ?

Error while deploying application in heroku

I am getting below error while creating app and deploying in heroku using below command
sudo git push heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I tried all the possible scenarios
creating new ssh key , giving admin rights to folder, deleting git remote for heroku and adding it again etc
Steps followed by me:
1) git init
2) git add .
3) git commit -m "Initial Commit"
4) heroku login
5) heroku create
6) sudo git push heroku master
Usually when we create new heroku project using "heroku create" it will create new project and that heroku URL is set as heroku GIT remote URL, but that also not happening everytime i am doing it manually. May be this also due to that same issue i guess...
Below is my detailed error
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ sudo mv ~/.ssh/ /.ssh_backup
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ heroku keys:add
Could not find an existing public key.
Would you like to generate one? [Yn] y
Generating new SSH public key.
Uploading SSH public key /home/ponvino/.ssh/id_rsa.pub... done
ponvino#ponvino-desktop:~/RubyWorkspace/prod/theScholarsPage$ git push heroku master
The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,50.19.85.156' (RSA) to the list of known hosts.
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Please help me
Thanks in Advance,
Check that your ssh key is loaded:
ssh-add -l
If not:
ssh-add ~/.ssh/your_private_key
Try again to push to heroku
You should generate pair of keys and add your public key to your heroku account.
More info: https://devcenter.heroku.com/articles/keys
ssh-keygen -t rsa
and then:
heroku keys:add
should be enough.
If nothing works even after trying the above solutions. do this
$ mv ~/.ssh/ ~/.ssh_backup
$ heroku keys:add
$ git push heroku master
Almost same problem was asked and answered in the link below.
Try it

Deploy Railsapp on Heroku

I'm trying to deploy my Rails app on heroku.
But on All things it would have to fail at the very last step.
My git is all set up, I got a working git repository, a heroku account, installed the heroku_toolbelt and I can login via "heroku login"
I also can create a new repository with "heroku create" and do get my url path and the feedback "git remote heroku added".
But trying to push it on heroku with "git push heroku master" fails and results in the following message:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
What kind of public key is being needed? and i Know the repository exists, it's there on my heroku account :/
I hope you can help me out!
You need to add your public key to Heroku - asumming you have one in your ~/.ssh folder (it would typically be called id_rsa.pub). If not generate one with ssh-keygen
heroku keys:add
should sort the problem out and you should be able to push your application.

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"

Resources