[英]git submodules - error: could not lock config file .git/modules/path/to/vimlib/config: No such file or directory
This is a weird one.这是一个奇怪的问题。 I created a repo years ago: https://github.com/todd-dsm/vimSimple
我几年前创建了一个仓库: https ://github.com/todd-dsm/vimSimple
I used submodules at the time;我当时使用子模块; thought it was a good idea;
认为这是个好主意; it's been a PITA since then.
从那时起,它就是一个 PITA。 I now need to update some of those submodules and I get this error on every single one
我现在需要更新其中一些子模块,并且每个子模块都出现此错误
% git submodule deinit -f vim/bundle/tlib_vim
Cleared directory 'vim/bundle/tlib_vim'
error: could not lock config file .git/modules/vim/bundle/tlib_vim/config: No such file or directory
warning: Could not unset core.worktree setting in submodule 'vim/bundle/tlib_vim'
It doesn't matter which submodule I choose, it's the same error as there is no 'modules' directory:我选择哪个子模块都没有关系,这与没有“模块”目录相同的错误:
% ls -al .git/modules
ls: cannot access '.git/modules': No such file or directory
Effectively, I've created an 'updates' branch, deleted some submodules:实际上,我创建了一个“更新”分支,删除了一些子模块:
othree/html5.vim.git
rodjek/vim-puppet.git
rodjek/puppet-lint.git
pearofducks/ansible-vim
python-mode/python-mode
elzr/vim-json
hashivim/vim-hashicorp-tools
Now, I need to update
the remaining submodules:现在,我需要
update
剩余的子模块:
% git config --file .gitmodules --name-only --get-regexp path
submodule.vim/bundle/syntastic.path
submodule.vim/bundle/tlib_vim.path
submodule.vim/bundle/vim-addon-mw-utils.path
submodule.vim/bundle/vim-fugitive.path
submodule.vim/bundle/vim-snipmate.path
submodule.vim/bundle/vim-snippets.path
submodule.vim/bundle/vim-lint.path
submodule.vim/bundle/Dockerfile.path
submodule.vim/bundle/L9.path
submodule.vim/bundle/vim-autocomplpop.path
It seems like it used to work one way and now, years later, it works another.似乎它曾经以一种方式工作,而现在,多年后,它又以另一种方式工作。 Is there any way out of this?
有没有办法解决这个问题? How would one solve this problem?
如何解决这个问题?
It seems like it used to work one way and now, years later, it works another.
似乎它曾经以一种方式工作,而现在,多年后,它又以另一种方式工作。
Yes, since Git 1.7.8 , the submodule is in $GIT_DIR/modules/<name>/
(that is .git/modules/<name>
usually), and no longer in the submodule folder itself ( <name>/.git
).是的,从 Git 1.7.8 开始,子模块位于
$GIT_DIR/modules/<name>/
(通常是.git/modules/<name>
)中,不再位于子模块文件夹本身( <name>/.git
)。
Check if your own submodules were created pre 1.7.8 (meaning before Q3 2011, eleven years ago).检查您自己的子模块是否是在 1.7.8 之前创建的(即 2011 年第三季度之前,即 11 年前)。
If so, the git submodule deinit
would not be efficient, and simply removing your submodule root folder should be enough (as well as updating manually the .gitmodules
file of your main repository).如果是这样,那么
git submodule deinit
将不会有效,只需删除您的子模块根文件夹就足够了(以及手动更新主存储库的.gitmodules
文件)。
From there, you can add those submodules back, using a recent Git.从那里,您可以使用最近的 Git 添加这些子模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.