Cannot push grails app to heroku master - Permission denied (publickey) - grails

Good Morning,
I have started deploying my grails app to Heroku.
I have been following this tutorial:
https://blog.heroku.com/archives/2011/12/15/grails
Everything was good until
git push heroku master
The error occured:
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?
Thanks

Heroku needs to get your SSH public key. See Managing your SSH Keys.
You need to generate an SSH key, if you don't have one yet.
ssh-keygen -t rsa
Then, you'll need to upload this public key to heroku
heroku keys:add
Heroku can now identify you for who you are, and will allow you to push to your repository.

Related

Cant push to Heroku from different machine

I cloned the repo from the URL mentioned in the dashboard settings in Heroku to a Windows machine. After committing changes, attempting to push to Heroku fails.
=> git push heroku master
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.
I followed some instructions from here, and now I am getting
=> git push heroku master
The authenticity of host 'heroku.com (50.19.85.156)' can't be established.
RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxx/o.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'heroku.com,xx.xx.xx.xx' (RSA) to the list of known hosts.
git#heroku.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Heroku git authenticates you using public keys that are added with heroku keys:add. You have to have a separate private/public SSH key pair for each machine you're working on.
Add a new key with heroku keys:add
And then verify it works with ssh -v git#heroku.com
https://devcenter.heroku.com/articles/keys#adding-keys-to-heroku

Connection refusal when pushing to Heroku, Bitbucket

I have had no issue pushing to Heroku or Bitbucket over the past few weeks. Now whenever I issue the command $ git push , or $ git push heroku I receive the same message:
ssh: connect to host git.bitbucket.org port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have been using the cloud9 IDE, pushing to BitBucket with no issue, and am really at my wits end in trying to determing why I can't push anymore....
Any advice out there?
It sounds like you haven't authorized your computer's SSH key. You'll need to log into Heroku / bitbucket and make sure that your local ~/.ssh/id_rsa.pub file is appropriately copied over.
For Heroku, if you're using their command line tool, you can add your SSH keys easily:
$ heroku keys:add
Just had this same problem. I had to restart the C9 server and things worked fine after that.

Rails app deployment on heroku

I have two heroku accounts one using email abc#gmail.com and one using xyz#gmail.com
previously I deployed a rails app to my xyz#gmail.com account but now I want to deploy to abc#gmail.com account using the same machine. I logged in using my credentials for abc#gmail.com using the following command
heroku login
but when I do a git push it still uses xyz#gmail.com and gives the error message that xyz#gmail.com does not have access to the application's repository.
I have generated the ssh key for account abc#gmail.com and added it to heroku as well so technically it should work but it is not
please help
Heroku login is only used for interaction with the CLI - git uses SSH.
You can either:
Add xyz#gmail.com as a collaborator to abc#gmail.com
or
Assuming that abc#gmail.com already has a public/private key uploaded to Heroku edit/Create ~/.ssh/config
Host heroku.abc
HostName heroku.com
IdentityFile ~/.ssh/<abc.key>
Update your projects ~/.git/config to use git#heroku.abc:.... in the remote entries.
So that git remote -v shows:
heroku git#heroku.abc:appname.git (fetch)
heroku git#heroku.abc:appname.git (push)
So now when you push to the heroku remote SSH will use the key defined on the heroku.abc entry in your ~/.ssh/config

Host key verification failed using gitlab and jenkins

I get Host key verification failed error whenever I try to put my GITLAB git address into Jenkins.
I've tried:
- using multiple different SSH paths. Including removing : and replacing /. Used http
- I've ssh and tried to run the command in the terminal, when prompted to say y/n I pressed Y.
- It works with Github.
- I've tried going to my jenkins/.ssh/ida_pub and adding my keys.
Failed to connect to repository : Command "/usr/local/git/bin/git ls-remote -h git#:/.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If you make the repo you are trying to connect to public in Gitlab (Settings -> Edit Project -> Public mode) you should be able to connect using http (but only http).
If the repo is not public you will need to install an SSH key on Jenkins that has permissions to access the repo. My understanding is that the Jenkins git plugin does not currently use the SSH credentials already stored in Jenkins so you will need to install the key on the master and slaves that will run this build. How you do this will depend on your OS but I find it easiest to use an SSH config file on Linux.

Problem with git push remote behind proxy

To set the context, I am trying to use the toto to set up my blog.
I did
$ sudo gem install toto
and the gems were installed properly.
Successfully installed rdiscount-1.6.8
Successfully installed toto-0.4.9
2 gems installed
After that, I tried
$ git clone git://github.com/cloudhead/dorothy.git myblog
but I get the following error
Cloning into myblog...
github.com[0: 207.97.227.239]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
My git http proxy settings are correct
jatin#jatin-ubuntu:~/myblog$ git config --global http.proxy
http://proxy:port
My http_proxy settings are also correct
jatin#jatin-ubuntu:~$ echo $http_proxy
http://proxy:port/
So, I replaced git by http, as
$ git clone http://github.com/cloudhead/dorothy.git myblog
and it worked.
Now, when I do the following
$ cd myblog
$ heroku create myblog
it works till here and I get
Creating myblog...... done
Created http://myblog.heroku.com/ | git#heroku.com:myblog.git
Git remote heroku added
But it fails down here:
$ git push heroku master
and the following error comes up
ssh: connect to host heroku.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly
I didn't know what to do, so after Googling a bit I found that you can't push changes to github using http.
On digging in further, I found this link
how-to-use-the-git-protocol-through-a-http-connect-proxy
which says that you can have your firewall administrator configure the proxy to also allow CONNECT for port 9418, which is the port used by git.
Once they have appropriately configured the proxy, you should then be able to use tools like netcat-openbsd or socat to connect through.
My problem is that I am a student and I can't get around this because I can't reach out to the administrator. I don't know what to do, as I am still stuck looking for an answer.
You added the heroku remote using this URL git#heroku.com:myblog.git. This was probably configured by the heroku create command.
When you push to this remote, it is done via SSH. And this is exactly what the error message indicates: that you (or git) tried to ssh to heroku.com, but couldn't because of your firewall (probably) denied that. With your git push heroku master command, you are not pushing to Github, but to the git repository at Heroku. To push your stuff to Github, you need to git push origin master and use either ssh or http for the transport. The git:// protocol itself does not support pushing changesets but is an unauthenticated re-only protocol.
Currently, Heroku seems to only allow the SSH transport for its git repos and there don't seem to be any direct hooks on Github (see Push from github to heroku without downloading repo). This means to publish your apps on Heroku, you need to be able to push to heroku.com via SSH from your local host.
You can also push to https://cloudhead#github.com/cloudhead/dorothy.git (note the username in the url).
When you push to this remote, it is done via SSH. The error you are getting is because the client could not connect via SSH, most likely because you are behind some type of firewall that is preventing the connection. I used to have this same problem when trying to push to Heroku from work.
My suggestion would be for you to develop locally and then go to some public hotspot to push the changes to Heroku (like a Starbucks).

Resources