Deploy Railsapp on Heroku - ruby-on-rails

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.

Related

Can run rake but not push to heroku

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.

Error pushing to Heroku after adding new domain

I recently added a new GoDaddy domain to my rails app.
Everything works fine when I push to git but when I try to push to Heroku using:
$ git push heroku
I get the following error:
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.
Is this problem occurring because I need to create another environment? The domain name for my GoDaddy website is listed under '$ heroku domains' but doesn't seem to be connected.
Any ideas would be helpful. TIA!
As for your comment on answer below, its obvious that you should try
git push prod master instead of git push heroku
'heroku' and 'prod' it's just names of remote repositories. Heroku by default creates repos named accordingly - 'heroku'. As far as I know it could be changed to whatever you need
This issue is probably unrelated to godaddy. Try typing
git remote -v
this will give you a list of the remote repositories you have setup. If none are pointing to your app on heroku you'll need to set it up.
Refer to this on article from heroku dev center
https://devcenter.heroku.com/articles/git
EDIT
As i suspected your heroku remote is named "prod" not "heroku" try 'git push prod' that should work.
You might have to specify the branch in which case the command would be 'git push prod master'
EDIT2
It looks your are not yet authorized to push to heroku. The root problem can vary. I recommend starting with this article:
https://devcenter.heroku.com/articles/keys
Also check this SO article
git push heroku master Write failed: Connection reset by peer

Heroku commands on Cygwin hangs

I am trying to use Heroku commands on Cygwin but they seem to not do anything, but hang.
I installed the Heroku toolbelt for Windows.
Doing the $ heroku version gives me heroku/toolbelt/3.10.5 (i386-mingw32) ruby/1.9.3.
But whenever I try a $ heroku login or $ heroku login it just hangs and does nothing.
I setup a Heroku remote in one of my Github repo folders and tried to heroku push master but it prompts me for my password, and I type it in, but gives me this message:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Help! Has anyone successfully used Heroku on Cygwin?
It sounds like heroku is trying to log in with your ssh key, which isn't added to your account. Ensure that you've added your public key to your heroku account (if you log in, go to account, add the ssh public key (~/.ssh/id_rsa.pub)). this might help you out as well.

Unable to push ruby on rails master project to heroku windows 8

I have a problem whenever I do git push heroku master, it gives me the following error:
!Invalid path!
Syntax is: git#heroku.com<app>.git where <app> is your app's name
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I have used MSysGit and I created a ruby on rails project, pushed it to github.
then in the project folder I did heroku login, succesfully authenticated. Did heroku create sucessfully, created a RSA keypair, added it to heroku. then I try to push to heroku and it fails everytime, anyone able to help?
The problem is that your SSH key being used is NOT yet uploaded to Heroku. I'm not familiar with your Git client, but what you need to do is find your SSH key file, then run:
heroku keys:add /path/to/my/key.pub
This will upload your public SSH key to Heroku, allowing you to push your repository.

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

Resources