微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 无法推送到github,ssh:无法解析主机名

我不能通过这个,多次重建存储库,使ssh密钥结束
--------------
demo_app <username>$git remote add origin git@github.com:<username>/demo_app.git

fatal: remote origin already exists.

$git push -u origin master
---
ssh: Could not resolve hostname git: nodename nor servname provided,or not kNown
---
fatal: Could not read from remote repository.
---
Please make sure you have the correct access rights
---
and the repository exists.
----------
---------

Checked ssh keys

---

$ssh -T git@github.com

Hi <username>! You've successfully authenticated,but GitHub does not provide shell access.

---

仍然收到相同的消息.

解决方法

而不是添加一个新的远程,请尝试使用以下命令更改现有的远程:
git remote set-url origin git@github.com:<username>/demo_app.git

编辑:所以,这里是使它的工作,而不会丢失你的代码的命令.

> rm -rf .git> git initgit remote add origin git@github.com:< username> /demo_app.git> git commit –allow-empty -m’首先提交’> git push origin master

原文地址:https://www.jb51.cc/ruby/273577.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐