有没有办法将子模块添加到裸 git 存储库?
我的服务器上有一些带有 gitosis 的存储库。其中之一是 Main,它包括所有其他的。我在本地计算机上使用它们,子模块层次结构是在我的本地计算机上构建的。 Gitosis 的存储库为裸(?),因此不可能在服务器上包含子模块。问题是,Main repo 有一个 Redmine 的裸克隆(项目管理。Redmine 显示统计信息、提交和文件的历史记录。它还允许直接在 wiki 中编写提交或文件或文件修订的引用链接)。但是当文件放置在子模块中时,redmine无法访问它们。那么,如何使子模块统计信息在裸存储库中可见?
=== upd ===
我不确定我的子模块是否始终包含在内。 Redmine 使用裸存储库的克隆,并且始终可以显示任何文件的统计信息,但子模块显示为大小为 0 的文件。我已经尝试过默认方案 [email protected]:Main .git
现在是 ssh://[email protected]/Main.git
子模块仍然显示为零- 长度的文件。
git-status 工作正常并显示子模块中未推送的提交,但存储库是文件。这很奇怪,但 redmine 现在显示来自子模块的提交,但以它自己奇怪的方式,看看这个:
现在我将尝试为每个子模块创建一个子项目,也许它会按应有的方式进行引用。 http://www.redmine.org/issues/3169 完全相关。
I have some repos on my server with gitosis. One of them is Main, it's including all the others. I work with them from my local machine, and submodules hierarchy was built on my local machine. Gitosis has repos as bare(?) so, it's impossible to include submodules on the server. Problem is, Main repo has a bare clone for Redmine (project management. Redmine shows stats, commits' and files' history. It also lets to write reflinks to commits or files or file's revision straight in wiki). But when files are placed in submodules, redmine cannot access them. So, how to make submodule stats visible in a bare repo?
=== upd ===
I'm not sure my submodules are always included. Redmine uses a clone of a bare repo and always can show stats for any file, but submodules are shown as files with 0 size. I've already tried default scheme [email protected]:Main.git
and now ssh://[email protected]/Main.git
submodules are still shown like zero-length files.
git-status
works fine and shows unpushed commits from submodules, but repos are files, though. This is strange, but redmine now shows commits from submodules but in its own weird way, look at this:
Now I'll try to create a subproject per every submodule, maybe then it will be referencing as it should be. http://www.redmine.org/issues/3169 is totally related.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
gitosis(或其更新版本gitolite)始终管理裸存储库,以允许任何用户(他们授权)进行推送,而不必担心工作树与索引不同步。
并且子模块始终“包含”在裸存储库中:子模块只是对相关提交的引用(加上子模块存储库的地址)。
可能使 Redmine 出错的原因是:
.gitmodules 中指定的地址 (url) 在 Redmine 上下文中未知。
例如,它使用 gitolite:aRepoName,其中 gitolite 是 ~/config 文件中定义的 ssh 快捷方式(请参阅 这里是配置文件的示例):尝试使用完整的 ssh uri 方案: ssh://[user@]host[:port][/path],并检查该地址是否在您的工作站和 Redmine 服务器上都有效。
使用一些选项(例如
git status --ignore-submodules=all
或status.submodulesummary
,默认为 false,防止状态显示摘要修改子模块的提交):至少尝试确保 Redmine 处于 git 环境中,其中status.submodulesummary
设置为 true。gitosis (or its more uptodate version gitolite) always manage bare repos, to allow any user (they authorize) to push to without worrying about a working tree not in sync with the index.
And submodules are always "included" in a bare repo: a submodule is just a reference to the relevant commit (plus an address to the repo of the submodule).
What could trip Redmine is:
the address (url) specified in the .gitmodules is unknown in the Redmine context.
For example, it uses gitolite:aRepoName, where gitolite is a ssh shortcut defined in your ~/config file (see here for an example of config file): try using a full ssh uri scheme: ssh://[user@]host[:port][/path], and check that address works both from your workstation, and from the Redmine server.
the use of some options (like
git status --ignore-submodules=all
orstatus.submodulesummary
which is by default to false, preventing status to display a summary of commits for modified submodules): try at least to make sure Redmine is in a git environment wherestatus.submodulesummary
is set to true.