当前位置:   article > 正文

Git submodule !Unable to checkout !应对办法

unable to checkout

github克隆使用了git子模块的仓库,因网络问题导致子仓库下载出错,命令行里会提示如:

Unable to checkout '726d14d02c95bb21ec9e43807751b491d295dd3c' in submodule path 'third_party/ktx'

解决办法:

1.进入子模块目录,重置

git reset --hard

2.检出确认

git checkout master

3.返回主仓库目录,查看状态;提示子仓库有修改,一般commit号不对应

  1. $ git status
  2. On branch master
  3. Your branch is up to date with 'origin/master'.
  4. Changes not staged for commit:
  5. (use "git add <file>..." to update what will be committed)
  6. (use "git checkout -- <file>..." to discard changes in working directory)
  7. modified: third_party/ktx (new commits)

4.更新子模块,匹配commit

  1. $ git submodule update
  2. Submodule path 'third_party/ktx': checked out '726d14d02c95bb21ec9e43807751b491d295dd3c'

5.确认

  1. $ git status
  2. On branch master
  3. Your branch is up to date with 'origin/master'.
  4. nothing to commit, working tree clean

 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号