0

私は数日間gitとgerritについて学ぼうとしていますが、適切な解決策が見つからないというエラーがあります。エラーメッセージは次のとおりです。

*asfaa@asadaf:~/test$ git review -R
Could not connect to gerrit.
Enter your gerrit username: remote0
Trying again with ssh://<username>@<ip>:29418/test
Creating a git remote called "gerrit" that maps to:
    ssh://<username>@<ip>:29418/test
This repository is now set up for use with git-review. You can set the
default username for future repositories with:
  git config --global --add gitreview.username "remote0"
Your change was committed before the commit hook was installed.
Amending the commit to add a gerrit change id.
remote: Processing changes: refs: 1, done    
To ssh://<username>@<ip>:29418/test
 ! [remote rejected] HEAD -> refs/publish/master (no common ancestry)
error: failed to push some refs to 'ssh://<username>@<ip>:29418/test'*

以下の手順の後にこのエラーが発生します。

  • コマンド「ssh -p 29418 user@localhost gerrit create-project project_name」で gerrit フォルダーを作成します。
  • 次に、ホームディレクトリに同じフォルダーを作成し、「git init」コマンドで git リポジトリに変換します。
  • 次に、プッシュしたいプロジェクトのすべてのコンテンツをこのフォルダーの gerrit リポジトリにコピーし、「git add --all」コマンドを使用してすべての変更を新しい変更として追加します。
  • .gitreview ファイルを作成し、ホストとプロジェクトの属性を入れます。
  • 私の変更をコミットします。
  • 最後に、「git review -R」コマンドを使用して、変更内容を gerrit リポジトリに送信し、レビューします。

ここで、最後のステップで、このコマンドgit push ssh://[username]@[ip]:29418/project_nameを使用すると機能します。ただし、この場合、レビューを行わずに直接 git にプッシュするため、gerrit リポジトリを使用しても意味がありません。さらに、後でこのプロジェクトを別のコンピューターに複製し、変更を gerrit リポジトリに送信するときに、このエラーに対処する必要があると思います。

前もって感謝します

4

2 に答える 2

1

新しいディレクトリで git init を実行してコードを追加する代わりに、新しい空の gerrit リポジトリを複製してそこに変更を加えることをお勧めします。したがって、手順を修正するには:

  1. コマンド「ssh -p 29418 user@localhost gerrit create-project project_name」で gerrit フォルダーを作成します。
  2. project_name の複製: clone ssh://user@localhost:29418/project_name
  3. 必要なプロジェクトのすべてのコンテンツをコピーし、「git add --all」
  4. .gitreview ファイルを作成し、ホストとプロジェクトの属性を入れます
  5. 変更をコミットする
  6. gitレビュー
于 2016-02-12T17:13:50.193 に答える