jthedudeoflife
jthedudeoflife

Reputation: 391

Cannot push to Heroku 'fatal: unable to access..Could not resolve host: (nil); nodename nor servname provided, or not known'

I have a few apps on Heroku, nothing has had this problem but I suddenly have had issues running git. Now I can't deploy my app to Heroku. When I run

git push heroku master

I get the following:

fatal: unable to access 'https://git.heroku.com/<herokuappname>.git/': Could not resolve host: (nil); nodename nor servname provided, or not known

When I run

git remote -v

I get the following:

heroku  https://git.heroku.com/<herokuappname>.git (fetch)
heroku  https://git.heroku.com/<herokuappname>.git (push)

I've looked up everything. Please help, thank you.

Upvotes: 26

Views: 27911

Answers (10)

Syre Musk
Syre Musk

Reputation: 81

This worked for me in the following order

git remote rm heroku
heroku login
heroku git:remote -a <app_name>
git push heroku master

Upvotes: 1

Onyilimba
Onyilimba

Reputation: 1217

One of the main causes of that error is simply a bad internet connection, If you come across issues like this, simply changing your internet connection or using a better option fixes this problem.

Upvotes: 1

Takib Ahmed
Takib Ahmed

Reputation: 41

This worked for me

  1. heroku git:remote -a app-name
  2. git push heroku master

Upvotes: 0

Steve F.
Steve F.

Reputation: 113

I was able to solve this issue by logging into heroku with heroku login

Upvotes: 3

Mitesh Anand
Mitesh Anand

Reputation: 143

If you have already connected any other remote from git using ssh then you have to connect heroku remote with ssh only. To check how remote connected:

git remote -v

just remove https remote of heroku, connect again with ssh remote. like:

git remote add heroku [email protected]:<yourProject>.git

It should work.

Upvotes: 0

Pavan Vasan
Pavan Vasan

Reputation: 407

Try exiting from the terminal, start a new terminal (comand line) process and go to the appropriate directory and then try to push to heroku master once again.

I had encountered an error similar to yours :-

fatal: unable to access 'https://git.heroku.com/<herokuappname>.git/': Could not resolve host: git.heroku.com

I did the same thing as mentioned above and it worked out well for me. I am hoping that it will work for you as well.

Upvotes: 4

Andrey
Andrey

Reputation: 21

This error make me mad ! It's happend again and again, tips above doesn't work for me. As u can see on screenshot I do nothing betwin attemps! It just work or don't, but more often don't !

Upvotes: 1

Christopher Govender
Christopher Govender

Reputation: 306

git remote -v
git remote rm heroku
git remote add heroku [email protected]:project(full url).git
heroku keys:add

These steps worked

Upvotes: 10

Sergey
Sergey

Reputation: 49728

Try this:

heroku keys:add

Worked for me

Upvotes: 29

Rachelle Uy
Rachelle Uy

Reputation: 858

Whenever this randomly happens to me, removing and adding heroku again as a remote reference always works.

First check if you do have heroku as a remote.

git remote -v

If heroku is present, remove it.

git remote rm heroku

Then add it back.

git remote add heroku [email protected]:project.git

Usually this works with me, try it and let me know what happens.

Upvotes: 52

Related Questions