Gerrit 复制插件重新加载时出现错误“FileBasedConfig 中缺少 ${name} 占位符”

Gerrit 复制插件重新加载时出现错误“FileBasedConfig 中缺少 ${name} 占位符”

我部署Gerrit操作系统的服务器是Ubuntu 18.04.05,我的Gitlab服务器的IP地址是192.168.0.167。我尝试使用replication插件将gerrit项目推送到本地Gitlab服务器。我的gerrit_site/etc/replication.config文件如下:

[remote "test_project"]
    url = [email protected]:testuser/test_project.git
    push = +refs/heads/*:refs/heads/*
    push = +refs/tags/*:refs/tags/*
    push = +refs/changes/*:refs/changes/*
    threads = 3
    project = test_project

我尝试replication通过以下命令重新加载插件:

ssh -l gerrit_admin -p 29418 127.0.0.1 gerrit plugin reload replication

我收到以下错误:

fatal: Unable to provision, see the following errors:

1) [Guice/ErrorInjectingConstructor]: ConfigInvalidException: remote.test_project.url "[email protected]:testuser/test_project.git" lacks ${name} placeholder in FileBasedConfig[/home/gerrit/gerrit_site/etc/replication.config]
  at DestinationsCollection.<init>(DestinationsCollection.java:72)
  at DestinationsCollection.class(DestinationsCollection.java:50)
  while locating DestinationsCollection
  while locating ReplicationDestinations

Learn more:
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

======================
Full classname legend:
======================
ConfigInvalidException:  "org.eclipse.jgit.errors.ConfigInvalidException"
DestinationsCollection:  "com.googlesource.gerrit.plugins.replication.DestinationsCollection"
ReplicationDestinations: "com.googlesource.gerrit.plugins.replication.ReplicationDestinations"
========================
End of classname legend:
========================

我想知道我是否忘记了任何配置?或者对 官方文件
我记得安装插件的时候OAuth,需要[plugin "gerrit-oauth"]在里面添加一个部分gerrit_site/etc/gerrit.config。但是replication的文档没有提到这一点。的replication文档是否认为我已经默认完成了?如果是这样,我应该如何修改gerrit_site/etc/gerrit.config

答案1

我最近也遇到了同样的问题。你可以检查你的replication.config,可能replication.config有重复的远程名称项,如下所示,这两个项目有相同的名称。

解决方案:将重复的项目重命名为唯一的名称。

[remote "test_project"]
    url = [email protected]:testuser/test_project.git
    push = +refs/heads/*:refs/heads/*
    push = +refs/tags/*:refs/tags/*
    push = +refs/changes/*:refs/changes/*
    threads = 3
    project = test_project

[remote "test_project"]
    url = [email protected]:testuser/another.git
    push = +refs/heads/*:refs/heads/*
    push = +refs/tags/*:refs/tags/*
    push = +refs/changes/*:refs/changes/*
    threads = 3
    project = test_project

相关内容