![](/img/trans.png)
[英]error: could not lock config file .git/config: No such file or directory
[英]git submodules - error: could not lock config file .git/modules/path/to/vimlib/config: No such file or directory
這是一個奇怪的問題。 我幾年前創建了一個倉庫: https ://github.com/todd-dsm/vimSimple
我當時使用子模塊; 認為這是個好主意; 從那時起,它就是一個 PITA。 我現在需要更新其中一些子模塊,並且每個子模塊都出現此錯誤
% 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'
我選擇哪個子模塊都沒有關系,這與沒有“模塊”目錄相同的錯誤:
% ls -al .git/modules
ls: cannot access '.git/modules': No such file or directory
實際上,我創建了一個“更新”分支,刪除了一些子模塊:
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
現在,我需要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
似乎它曾經以一種方式工作,而現在,多年后,它又以另一種方式工作。 有沒有辦法解決這個問題? 如何解決這個問題?
似乎它曾經以一種方式工作,而現在,多年后,它又以另一種方式工作。
是的,從 Git 1.7.8 開始,子模塊位於$GIT_DIR/modules/<name>/
(通常是.git/modules/<name>
)中,不再位於子模塊文件夾本身( <name>/.git
)。
檢查您自己的子模塊是否是在 1.7.8 之前創建的(即 2011 年第三季度之前,即 11 年前)。
如果是這樣,那么git submodule deinit
將不會有效,只需刪除您的子模塊根文件夾就足夠了(以及手動更新主存儲庫的.gitmodules
文件)。
從那里,您可以使用最近的 Git 添加這些子模塊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.