简体   繁体   English

git submodules - 错误:无法锁定配置文件 .git/modules/path/to/vimlib/config:没有这样的文件或目录

[英]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.

相关问题 错误:无法锁定配置文件.git/config:没有这样的文件或目录 - error: could not lock config file .git/config: No such file or directory git错误“无法锁定配置文件.git / config权限被拒绝” - git error “could not lock config file .git/config permission denied” "如何修复 Git for Windows 错误:“无法锁定配置文件 C:\/file\/path\/to\/.gitconfig: 文件存在”?" - How to fix Git for Windows error: "could not lock config file C:/file/path/to/.gitconfig: File exists"? SVN到GIT存储库的迁移,错误:无法锁定配置/元数据文件 - SVN to GIT repositories migration, Error : could not lock the config / metadata file 配置文件迁移后“Git 错误:无法锁定配置文件 C:/Users/old_profile/.gitconfig: No such file or directory” - “Git error: could not lock config file C:/Users/old_profile/.gitconfig: No such file or directory” after profile migration 错误的错误消息“无法锁定配置文件.git / config:权限被拒绝”,原因是未进行分阶段的更改; 在安装openJDK 8时在Homebrew中 - error of “could not lock config file .git/config: Permission denied” due to unstaged changes; in Homebrew while installing openJDK 8 Git错误:无法提交配置文件 - Git error: could not commit config file 无法使Tower(OSX git GUI)忽略文件权限–“无法锁定配置文件.git / config”错误 - Can't get Tower (OSX git GUI) to ignore file permissions – “could not lock config file .git/config” error Git配置文件错误 - Git config file error git:无法锁定配置文件权限被拒绝和无效参数 - git: could not lock config file Permission denied & Invalid argument
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM