Helix4Git管理者ガイド (2019.1)

SSH用にGerritを設定する

SSHキーの設定

重要

ターゲットリポが既にHelixサーバ内に存在していてはいけません。

ソースリポは、空になっていてはいけません。

  1. Git Connectorサーバにroot ユーザとしてログインします。

  2. .sshディレクトリを作成します。

    mkdir /var/www/.ssh

  3. ディレクトリの所有者をweb-service-userに割り当てます。

    chown web-service-user:gconn-auth /var/www/.ssh

  4. ユーザをrootからweb-service-userに切り替えます。

    Ubuntu CentOS
    su -s /bin/bash - www-data su -s /bin/bash - apache

    Git ConnectorインスタンスのパブリックSSHキーとプライベートSSHキーを生成します。

    ssh-keygen -t rsa -b 4096 -C web-service-user@gitConnector.com

    プロンプトに従います。

  5. パブリックキーを検索します。

    /var/www/.ssh/id_rsa.pub

  6. このパブリックキーをGerritサーバにコピーして、/var/www/.ssh/id_rsa.pubを、ミラーリング用にクローンおよびフェッチを実行するユーザアカウント(helix-user)に追加します。
  7. ミラーリング用にWebhookを設定します。
    1. 環境変数GCONN_CONFIGgconn.confファイルへの絶対パスに設定します。

      export GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf

    2. Webhookを追加します。

      gconn --mirrorhooks add graphDepotName/repoName ssh://helix-user@GerritHost.com/repoName.git

  8. --mirrorhooksコマンドで生成するsecretトークンを保存します。

    ヒント

    secretトークンも/opt/perforce/git-connector/repos/graphDepotName/repoName.git/.mirror.configに保存されます。

Gerritサーバでの処理

GERRIT_SITE/git/repoName/configファイルのGerritリポジトリの構成ファイルを更新します。

この場合、GERRIT_SITEは、使用するGerritサーバのルートディレクトリです。

[gconn]
mirror-url = https://GitConnector.com/mirrorhooks
token = <secret_token from /opt/perforce/git-connector/repos/graphDepot/repoName.git/.mirror.config>
git-ssh-url = <upstream_url from /opt/perforce/git-connector/repos/graphDepot/repoName.git/.mirror.config>
[gconn "http"]
sslverify = false

次の手順

ミラーフックのテスト