开发者

Is there a way to add submodules to a bare git repository?

开发者 https://www.devze.com 2023-03-25 05:56 出处:网络
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. Gitosi

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 mak开发者_如何学JAVAe 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 git@123.456.789.001:Main.git and now ssh://git@123.456.789.001/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:

Is there a way to add submodules to a bare git repository?

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.


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 or status.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 where status.submodulesummary is set to true.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号