Git告诉我,我无法在索引中添加一些文件,因为它们位于子模块中。我认为这些文件曾经存在于子模块中,但我发现它们仍然存在于子模块中。如果我为.gitmodules grep,我一无所获。如何消除这个幻像子模块,以便将文件添加到索引中?
ryan@ryan-HP-ProBook-4530s:/opt/staging/my.domain.com/public/profiles/mei_main$ ls
civicrm_starter.sql mei_main.info mei_main.install mei_main.profile modules themes
ryan@ryan-HP-ProBook-4530s:/opt/staging/my.domain.com/public/profiles/mei_main$ git add themes
fatal: Path 'profiles/mei_main/themes' is in submodule 'profiles/mei_main'
ryan@ryan-HP-ProBook-4530s:/opt/staging/my.domain.com/public/profiles/mei_main$ ls -la
total 4704
drwxr-xr-x 4 48 502 4096 Aug 19 11:58 .
drwxr-xr-x 6 48 502 4096 Aug 19 11:49 ..
-rwxr-xr-x 1 503 502 4786089 Apr 29 13:43 civicrm_starter.sql
-rwxr-xr-x 1 48 502 2985 Jun 4 02:20 mei_main.info
-rwxr-xr-x 1 48 502 579 Jun 4 02:20 mei_main.install
-rwxr-xr-x 1 48 502 736 Jun 4 02:20 mei_main.profile
drwxr-xr-x 4 48 502 4096 Aug 26 17:26 modules
drwxr-xr-x 4 48 502 4096 Aug 16 10:23 themes
ryan@ryan-HP-ProBook-4530s:/opt/staging/my.domain.com/public/profiles/mei_main$ cd ../../
ryan@ryan-HP-ProBook-4530s:/opt/staging/my.domain.com/public$ grep path .gitmodules | sed 's/.*= //'
grep: .gitmodules: No such file or directory
答案 0 :(得分:0)
如果缺少.gitmodules
文件,请查看.git/config
内部。有关如何清理所有内容的详细信息,请参阅here。
答案 1 :(得分:0)
我能够通过重命名git使目录对git可见...
mv个人资料profile2
重命名后,git可以看到它,我可以将它添加到repo ...
git add profiles2
然后......
git mv profiles2个人资料
当将更改下拉到登台站点时,git中止,抱怨它无法覆盖未跟踪的文件。所以,我不得不在舞台上重命名这个目录...
mv个人资料profile2
然后,我可以拉......
git pull
最后,将旧的未跟踪的个人资料目录移动到某处以便安全保存......
mv profiles2~