本文介绍了Git子模块绝对worktree路径配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这是我的子模块 redmine_dashboard 配置文件: 子模块配置文件 [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true worktree = / Users / daniel / redmine / vendor / plugins / redmine_dashboard [remoteorigin] fetch = + refs / heads / *:refs / remotes / origin / * $ b $ url = git @ github。 com:ebc / redmine_dashboard.git [branchmaster] remote = origin merge = refs / heads / master [gui] wmstate = normal geometry = 841x391 + -8 + 43 187 177 Mac worktree = / Users / daniel / redmine / vendor / plugins / redmine_dashboard Linux worktree = / home / daniel / redmine / vendor / plugins / redmine_dashboard 问题 我可以更改此绝对路径一个 有关系吗?例如: worktree = ../../vendor/plugins/redmine_dashboard 解决方案是的,您应该可以用相对路径更新配置文件。您还应更新子模块根目录下的 .git 文件中的worktree目录作为返回该模块的相对路径。 我相信这是固定的(至少)最新版本的git(1.7.10.1)。我似乎无法找到更新日志,所以我不知道它何时修复。我可以通过删除 .git / modules 文件夹中的子模块和文件夹,然后重做 git submodule init 和 git子模块更新。 This is my submodule redmine_dashboard config file:Submodule config file:[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true worktree = /Users/daniel/redmine/vendor/plugins/redmine_dashboard[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = [email protected]:ebc/redmine_dashboard.git[branch "master"] remote = origin merge = refs/heads/master[gui] wmstate = normal geometry = 841x391+-8+43 187 177Macworktree = /Users/daniel/redmine/vendor/plugins/redmine_dashboardLinuxworktree = /home/daniel/redmine/vendor/plugins/redmine_dashboardIssueCan I change this absolute path for a relative? Something like:worktree = ../../vendor/plugins/redmine_dashboard 解决方案 Yes, you should be able to update the config file with a relative path. You should also update the worktree dir in the .git file in the submodule root to be a relative path back to that module.I believe this is fixed in (at least) the most current version of git (1.7.10.1). I can't seem to find a changelog, so I have no idea when it got fixed. I was able to have git fix the issue by deleting both the submodule and the folder in the .git/modules folder and then redoing git submodule init and git submodule update. 这篇关于Git子模块绝对worktree路径配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 03:32