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

查看:37
本文介绍了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.

我还在 gitlab 中添加了我的 ssh.我该怎么办?

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

推荐答案

我遇到了同样的错误.

更改 .gitconfig.config/git/config 中的 [remote "origin"] url 值代码>文件

Change the [remote "origin"] url value in .gitconfig or .config/git/config file

以前:

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

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

新功能:

git@github.com:userName/repo.git

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

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