git submodule update --init 给出错误致命:需要单个修订版无法在子模块路径中找到当前修订版

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38227598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:05:43  来源:igfitidea点击:

git submodule update --init gives error fatal: Needed a single revision Unable to find current revision in submodule path

gitjenkins

提问by Biplab Biswas

When i execute git submodule update --initI get error

当我执行git submodule update --init我得到错误

fatal: Needed a single revision Unable to find current revision in submodule path 'plugins/pluginname'.

致命:需要单个修订版无法在子模块路径“插件/插件名称”中找到当前修订版。

Actually I was trying to run a Jenkins Job to deploy it. I added Recursively update submodules as additional behavior in Jenkins. FATAL: Command "git.exe submodule update --init --recursive" returned status code -1: This is occurring only from my local as same command is working for others.

实际上,我试图运行一个 Jenkins 作业来部署它。我在 Jenkins 中添加了递归更新子模块作为附加行为。致命:命令“git.exe submodule update --init --recursive”返回状态代码 -1:这仅在我的本地发生,因为相同的命令对其他人有效。

回答by Francis Bacon

Try git submodule foreach git pull

尝试 git submodule foreach git pull

回答by d33tah

It's an example of a hidden actual error in Git, a UX pitfall typical to Git.

这是 Git 中隐藏的实际错误的一个示例,这是 Git 的典型 UX 陷阱。

In my case the real error was that I was using a submodule pinned to a branch that doesn't exist anymore (e.g. feature branch that was already merged and deleted via Gitlab). Verify if that's the case for you as well and if it is, point the submodule to a new branch.

在我的情况下,真正的错误是我使用了一个固定到不再存在的分支的子模块(例如,已经通过 Gitlab 合并和删除的功能分支)。验证您是否也是这种情况,如果是,请将子模块指向一个新分支。