300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Could not resolve hostname xxx.com: Name or service not known

Could not resolve hostname xxx.com: Name or service not known

时间:2023-03-08 05:35:37

相关推荐

Could not resolve hostname xxx.com: Name or service not known

Could not resolve hostname : Name or service not known

今天构建项目时,报错,感觉是更新子仓代码的问题,试了git submodule initgit submodule update还是报一样的错:

ssh: Could not resolve hostname : Name or service not knownfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.Unable to fetch in submodule path 'xxx'exit status 1-03-06 10:22:02 FATAL cmd/main.go:65 exit status 1

问大佬,扔给我一个git submodule sync --recursive

git官方文档的解释是

sync [--recursive] [--] [<path>…​]Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules. It will only affect those submodules which already have a URL entry in .git/config (that is the case when they are initialized or freshly added). This is useful when submodule URLs change upstream and you need to update your local repositories accordingly.git submodule sync synchronizes all submodules while git submodule sync -- A synchronizes submodule "A" only.If --recursive is specified, this command will recurse into the registered submodules, and sync any nested submodules within.

大致意思就是

sync 子模块的远程URL配置设置为.gitmodules中指定的值。它只会影响那些在 .git/config 中已经有URL条目的子模块(当它们被初始化或新添加时就是这样)。当子模块 url 在上游发生变化,需要相应地更新本地存储库时,这是非常有用的。

git子模块sync同步所有子模块,而git子模块sync – A 则指定了模块,所以只同步子模块“A”。

如果指定了 --recursive,该命令将递归到已注册的子模块中,并同步其中的任何嵌套子模块。

问题出现的原因就是:

在你拉取的提交中, 可能 .gitmodules 文件中记录的子模块的 URL 发生了改变。

所以通过git submodule sync --recursive进行更新即可

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。