从github克隆使用了git子模块的仓库,因网络问题导致子仓库下载出错,命令行里会提示如:
Unable to checkout '726d14d02c95bb21ec9e43807751b491d295dd3c' in submodule path 'third_party/ktx'
解决办法:
1.进入子模块目录,重置
git reset --hard
2.检出确认
git checkout master
3.返回主仓库目录,查看状态;提示子仓库有修改,一般commit号不对应
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: third_party/ktx (new commits)
4.更新子模块,匹配commit
$ git submodule update
Submodule path 'third_party/ktx': checked out '726d14d02c95bb21ec9e43807751b491d295dd3c'
5.确认
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean