git - git子模块更新失败
问题描述
我有元 repo,名为 anecdotes,它有两个子模块 - utils 和 global-sync。全局同步中也有 utils 子模块。在轶事回购中有 .gitmodules 文件,内容如下:
[submodule "globals-sync"]
path = globals-sync
url = https://github.com/organization/globals-sync.git
branch = master
[submodule "utils"]
path = utils
url = https://github.com/organization/utils.git
branch = master
全局同步 .gitmodules 文件内容为:
[submodule "utils"]
path = utils
url = https://github.com/organization/utils.git
utils repo 的默认分支是 develop,global-sync repo 的默认分支是 master(正如我所说,global-sync repo 包含 utils 子模块)。
git版本是2.30
现在 - 描述问题: 在 github 操作中,尝试从轶事 repo 进行部署。首先,我检查轶事回购 - 通过这样做,此时检查回购和子模块(获取和克隆它)的操作 - 正确检查了全局同步和实用程序回购(意味着 - 因为它正在轶事回购中提交)
现在,我想将子模块更新为最新的提交(在远程)所以我运行:
git submodule update --remote
立即失败并出现以下错误:
fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'utils'
在阅读了很多类似的问题后,我可以隔离问题:: here
通过 cd 到 utils 目录并获取有关 repo 的信息,我看到“master”分支不存在:“git branch -a”仅列出了开发分支
有任何想法吗?
- 我删除了轶事中的 utils 目录并克隆了它 - 问题仍然存在。
- 尝试在本地更新子模块 - 成功。
解决方案
问题是我没有在 yaml 文件中明确设置 fetch-depth。默认 fetch-depth 为 1,只需添加 0 值(表示全部),然后我就可以看到所有分支。使用:actions/checkout@v2 with:token:${{ secrets.GITHUB }} 子模块:'recursive
推荐阅读
- pandas - 将熊猫数据框上传到红移 - 关系“sqlite_master”不存在
- python - UnicodeDecodeError:“charmap”编解码器无法解码位置 24 中的字节 0x81:字符映射到
- c# - 在 C# 中的 rabbit Mq 中获取 xDeath 中队列消息的最大重试次数
- jquery - 取消先前的 ajax 调用并在文本发生更改时从头开始
- angular - 试图列出 Firestore 数据库的集合
- android - 是否可以仅允许某个 webview 的明文 HTTP 流量?
- flutter - GestureDetector 内卡片中的图像
- android - PiracyChecker 无法检查应用程序是否从 Google Play 商店安装
- javascript - 基于 .(dot) 的嵌套对象
- multithreading - 无法为位于不同线程qt c ++中的父级创建子级