【问题标题】:gitolite: add the same config to all reposgitolite:将相同的配置添加到所有 repos
【发布时间】:2011-08-17 15:39:05
【问题描述】:

我想为我所有由 gitolite 管理的存储库自动添加相同的配置值。我认为将以下内容添加到 gitolite.conf 就可以了:

repo @all
    config hooks.mailinglist = me@example.org

虽然 gitolite 在我推送时没有抱怨,但 @all 配置项都不会添加到单个存储库中(尽管任何特定的都会添加)。

【问题讨论】:

    标签: git gitolite


    【解决方案1】:

    gitolite documentation 确实提到这是一种“特定于存储库”的机制,这意味着似乎不支持存储库组。

    The implementation 似乎证实了这一点,因为实际git config 之前的评论指出:

    重要提示:接下来的 3 个订阅者 (setup_*) 假设 $PWD 是裸仓库本身

    接下来是执行git config的函数:

    # ----------------------------------------------------------------------------
    # set/unset git configs
    # ----------------------------------------------------------------------------
    
    sub setup_git_configs
    {
        my ($repo, $git_configs_p) = @_;
    
        while ( my ($key, $value) = each(%{ $git_configs_p->{$repo} }) ) {
            if ($value ne "") {
                $value =~ s/^"(.*)"$/$1/;
                system("git", "config", $key, $value);
            } else {
                system("git", "config", "--unset-all", $key);
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-05
      • 1970-01-01
      • 1970-01-01
      • 2011-09-07
      • 1970-01-01
      • 2018-11-06
      • 2018-04-24
      • 1970-01-01
      相关资源
      最近更新 更多