这是我做错了什么,还是更广泛的错误?
如果我在一个空目录中执行以下 git 命令:
git init
git submodule add https://github.com/doctrine/DoctrineMongoODMModule \vendor\DoctrineMongoODMModule
git submodule update --init --recursive
一切顺利,多个子模块被拉取,然后失败,输出如下:
fatal: not a git repository: ../../../../../../../../../../.git/modules/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doctrine-mongodb/modules/lib/vendor/doctrine-common
Unable to find current revision in submodule pat 'lib/vendor/doctrine-common'
我做了更多的挖掘工作。导致问题的子模块中的 .git 文件具有以下内容:
gitdir: ../../../../../../../../../../.git/modules/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doctrine-mongodb/modules/lib/vendor/doctrine-common
我已经检查了 gitdir 路径,它确实存在。但是,我使用的是 Windows XP 机器,如果我从 cmd 提示符尝试此操作,我会遇到问题:
C:\xds\sds\vendor\DoctrineMongoODMModule\vendor\mongodb-odm\lib\vendor\doctrine-
mongodb\lib\vendor\doctrine-common>cd ../../../../../../../../../../.git/modules
/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doc
trine-mongodb/modules/lib/vendor/doctrine-common
The system cannot find the path specified.
看来目录更改字符串太长了,因为如果我将它分成两部分,它可以工作:
C:\xds\sds\vendor\DoctrineMongoODMModule\vendor\mongodb-odm\lib\vendor\doctrine-
mongodb\lib\vendor\doctrine-common>cd ../../../../../../../../../../.git/modules
/vendor/DoctrineMongoODMModule/modules/vendor/mongodb-odm/modules/lib/vendor/doc
trine-mongodb/
C:\xds\sds\.git\modules\vendor\DoctrineMongoODMModule\modules\vendor\mongodb-odm
\modules\lib\vendor\doctrine-mongodb>cd modules/lib/vendor/doctrine-common
C:\xds\sds\.git\modules\vendor\DoctrineMongoODMModule\modules\vendor\mongodb-odm
\modules\lib\vendor\doctrine-mongodb\modules\lib\vendor\doctrine-common>
任何建议或帮助将不胜感激。干杯。