ssh:无法解析主机名git:名称或服务未知致命:无法从远程存储库读取 [英] ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository

查看:705
本文介绍了ssh:无法解析主机名git:名称或服务未知致命:无法从远程存储库读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将我的仓库从HTTPS切换到SSH之后,当我推送到原始主机时收到此错误:

After I switched from HTTPS to SSH for my repo then I received this error when pushing to origin master:

ssh: Could not resolve hostname git: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我还将ssh添加到gitlab中.我该怎么办?

I also add my ssh in the gitlab. What should I do?

推荐答案

我遇到了同样的错误.

我更改了.git/config文件中的[remote "origin"] url值,现在它可以正常工作.

I changed the [remote "origin"] url value in .git/config file and now it's working fine.

以前:

https://git@github.com:userName/repo.git

OR

ssh://git@github.com:userName/repo.git

新功能:

git@github.com:userName/repo.git

这篇关于ssh:无法解析主机名git:名称或服务未知致命:无法从远程存储库读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆