git 无法推送到 Heroku 'fatal: 无法访问..无法解析主机:(nil); 提供了节点名或服务名,或未知'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28641851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot push to Heroku 'fatal: unable to access..Could not resolve host: (nil); nodename nor servname provided, or not known'
提问by jthedudeoflife
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
我在 Heroku 上有几个应用程序,没有遇到过这个问题,但是我突然在运行 git 时遇到了问题。现在我无法将我的应用程序部署到 Heroku。当我跑
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.
我查过一切。请帮忙,谢谢。
回答by Rachelle Uy
Whenever this randomly happens to me, removing and adding heroku again as a remote reference always works.
每当我随机发生这种情况时,再次删除和添加 heroku 作为远程引用总是有效的。
First check if you do have heroku as a remote.
首先检查你是否有 heroku 作为遥控器。
git remote -v
git remote -v
If heroku is present, remove it.
如果 heroku 存在,请将其删除。
git remote rm heroku
git remote rm heroku
Then add it back.
然后再添加回来。
git remote add heroku [email protected]:project.git
git remote add heroku [email protected]:project.git
Usually this works with me, try it and let me know what happens.
通常这对我有用,尝试一下,让我知道会发生什么。
回答by Sergey
Try this:
尝试这个:
heroku keys:add
Worked for me
对我来说有效
回答by Christopher Govender
git remote -v
git remote rm heroku
git remote add heroku [email protected]:project(full url).git
heroku keys:add
These steps worked
这些步骤有效
回答by Pavan Vasan
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.
尝试从终端退出,启动一个新的终端(命令行)进程并转到相应的目录,然后再次尝试推送到 heroku master。
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.
我做了上面提到的同样的事情,对我来说效果很好。我希望它也适用于你。
回答by Mitesh Anand
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:
如果您已经使用 ssh 从 git 连接了任何其他远程,那么您必须仅使用 ssh 连接 heroku 远程。要检查远程连接方式:
git remote -v
just remove https remote of heroku, connect again with ssh remote. like:
只需删除heroku的https远程,再次使用ssh远程连接。喜欢:
git remote add heroku [email protected]:<yourProject>.git
It should work.
它应该工作。
回答by Andrey
This error make me mad ! It's happend again and again, tips above doesn't work for me. As u can see on I do nothing betwin attemps! It just work or don't, but more often don't !
这个错误让我很生气!它一次又一次地发生,上面的提示对我不起作用。正如你所看到的,我在尝试之间什么都不做!它只是工作或不工作,但更多时候没有!