Stefan
Stefan

Reputation: 3859

How do you connect a git repo to gerrit?

I have installed git and setup gerrit on my local PC.

In my folder C:\git\Gerrit\git I have created a repo. I made come changes to the contained file, added and committed it.

I then pushed it to gerrit using the command:

git push origin head:refs/for/master

and I get the reply:

Enumerating objects: 5, done. Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 273 bytes | 273.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To origin 71f7b5d..0375419 head -> refs/for/master

Whereas in documentation I have followed the reply was supposed to be of the form

$ git commit [master 3cc9e62] Change to a proper, yeast based pizza dough. 1 file changed, 10 insertions(+), 5 deletions(-) $ git push origin HEAD:refs/for/master Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 532 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Processing changes: new: 1, done remote: remote: New Changes: remote:
http://gerrithost/#/c/RecipeBook/+/702 Change to a proper, yeast based pizza dough. remote: To ssh://gerrithost:29418/RecipeBook * [new branch] HEAD -> refs/for/master

But nothing appears in gerrit. I am looking on the page identified as the CannonicalWebURL in the config file.

I presume I need to link the repo and gerrit together somehow but I cannot seem to work out how to do it. Has anyone gone through this?

Upvotes: 1

Views: 4630

Answers (1)

I don't know how did you get the remote "gerrit MyMachineName.MyDomain.local:TestProject" using just "git init" (is there any configuration in your .gitconfig file?) but if you want to create a new repository in Gerrit you must do the following steps:

  1. Log in the Gerrit web tool
  2. Create the repository in the Gerrit UI at BROWSE > Repositories > CREATE NEW
  3. Clone the empty repository using the "git clone" command available in the Gerrit UI at BROWSE > Repositories >
  4. Create whatever you want and commit your changes
  5. Push to Gerrit executing: "git push origin HEAD:refs/for/master"

See more info in the Gerrit documentation here

Upvotes: 1

Related Questions