ssh: Could not resolve hostname github.com: Name or service not known
这个错误的原因是因为 remote origin 的 url 设置错误
出现这个问题普遍设置为了 下面这两种
https://git@github.com/userName/repo.git
or
ssh://git@github.com/userName/repo.git
其实不需要指定协议号
直接 设置为
git@github.com/userName/repo.git
这样就可以正确的使用git了
本文介绍了在遇到Git连接GitHub时出现'Could not resolve hostname'错误的原因,主要是由于remote origin URL设置不正确。通常设置为包含'https://'或'ssh://'的格式,但其实可以直接使用'git@github.com:用户名/仓库名.git'的格式。通过修正这个URL,可以解决Git的远程连接问题,确保正常进行代码推送和拉取操作。
3113

被折叠的 条评论
为什么被折叠?



