Skip to content
ghdrako edited this page Dec 12, 2023 · 27 revisions
  • https://gerritcodereview-test.gsrc.io/

  • https://github.com/GerritCodeReview

  • The http password is usually generated by Gerrit. Each user should o to Settings > HTTP Password and generate his/her password there.

  • Gerrit doesn't manage users' password: as you are using HTTP Auth you need to setup a form yourself to manage the provisioning of passwords.

  • The "generate HTTP Password" in Gerrit is to allow Git/HTTP operations (not the Gerrit WebUI password).

  • The HTTP Password screen sets/resets HTTP passwords for gerrit users iff the mode of communication/authentication through CLI is HTTP (and not ssh)

Instalacja ansible

gerrit

Basically: You submit your proposed software change (often called "patch", in Gerrit called "changeset") as a new branch. If the first version ("patchset 1") is not yet perfect, you can make more changes ("amend") in that branch ("patchset 2", etc.). Once a patchset receives a "+2" review, it will get accepted and merged into the main branch of the code repository (usually called "master"). Merging means that your change is included by default when anyone checks out or downloads that code repository.

git config

git config --global user.name "<user>"
git config --global user.email <email>
ssh-keygen
vi ~/.ssh/id_rsa.pub
~/.ssh$ cat config 
KexAlgorithms +diffie-hellman-group1-sha1 
PubkeyAcceptedAlgorithms +ssh-rsa 
HostkeyAlgorithms +ssh-rsa 

Host gerrit.inteligo.com.pl 
    User <gerrit user>

Add cert

git config --global http.sslCAInfo [full_path_to]/PKOBANKPOLSKIInfrastructureCA.crt

Config for gerrit

git config --global url."ssh://<gerrit_user>@<gerrit_url>:29418/".insteadOf "ssh://<gerrit_url>:29418/"

Clone repo

git clone ssh://<gerrit_user>@<gerrit_url>:29418/<repo_name> && scp -p -P 29418 <gerrit_user>@<gerrit_url>:hooks/commit-msg <repo_name>/.git/hooks/

Push changes to repo (wyslanie do recenzji) - nie robic bezposrednio git push

git push origin --no-thin HEAD:refs/for/master
git push origin --no-thin HEAD:refs/for/<branch_name>

Pobranie refow z repozytorium

git fetch origin "+refs/changes/*:refs/remotes/origin/changes/*"

Create branch

git checkout -b name_of_branch origin/master

Wyslanie localnego brancha do gerrita

git push origin HEAD

Drop local repo

git branch -d acphotfix  # drop local brantch merged
git branch -D acphotfix  # drop local brantch not merged

The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

Drop remote repo

git push origin --delete acphotfix # drop  remote branch

You can also use this shorter command to delete a branch remotely: git push <remote> :<branch>

For example:

git push origin :fix/authentication
git push origin :acphotfix

Try to synchronize your branch list using:

git fetch -p

The -p flag means "prune". After fetching, branches which no longer exist on the remote will be deleted.

Test

Clone this wiki locally