Connection refusal when pushing to Heroku, Bitbucket - ruby-on-rails

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.

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

Can't clone own github repository, get obscure fatal error

So I made changes to my rails app on my local machine that were never committed and that I decided to discard. Decided to rollback to most recent commit by deleting my rails app and all its files, and then cloning my most recent commit from my github repository. Unfortunately
git clone https://github.com/my_username/rails_app.git
results in the following error that cannot be found by just googling:
Cloning into 'sample_app2'...
fatal: unable to access 'https://github.com/IPX-/sample_app2.git/': SSLRead() return error -9806
I was recently pushing to the repo earlier today, even set up an SSH key for my this laptop, but all to no avail.
Why is git clone not working for my own repository?
Possible error due to low internet connection. This error occurred when you try to connect to server through ssl and net connection drop immediately. Or some time due to frequent disconnection. YOu can find more about this here http://flummox-engineering.blogspot.in/2014/04/sslread-return-error-9806-server.html
Possible duplicate of SSLRead() error using Git in Mavericks OS X 10.9.2
Anyhow, the answer mentioned here is that you download SSL and install.
When you have already set up SSH then why don't you access your repo over SSH?
You can use user.name#github.com:<your-repo> and it will not ask you for password if you have actually set-up SSH properly!
Enjoy!

cannot connect heroku - when writing heroku update - ruby on rails

i am trying to connect heroku
i downloaded heroku toolbelt and installed it .
then from the command prompt i type :
heriku login
althogh i type the right credentials (i checked!!) i get
! Unable to connect to Heroku API, please check internet connectivity and
try again.
I wanted to be sure its not something with authentication
so i typed :
heroku update
just to set up a connection that doesn't need a password.
i get the message:
! Unable to connect to Heroku API, please check internet connectivity and
try again.
i saw some answers that talked about the remote option so i did that:
heroku git:remote -a my-app-name
and i got the same response.
the internet connection is ok because the git program is able to push to github.
even when i run
heroku install:something
it works.
so I tried to debug:
i downloaded a git bash so i can operate in unix through SSH
and I followed this stack question comments and tried it:
ssh git#heroku.com -T
and got :
warning permanently added the RSA host key for ip address '50.19.85.132' to the list of
known hosts.
permission denied (publickey)
then I tried to check DNS response:
ssh host heroku.com
and got :
ssh: host: no address associated with the name.
so i guess that my connection get blocked regardless of SSH .
i run netstat -a and it seems that port: 22 , 443 , 5000 that heroku uses are free.
i turned the firewall off and still no conection
what should i do?
Try heroku login first. It authenticates you.

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

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.

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