-
Notifications
You must be signed in to change notification settings - Fork 1
Get Started
Joshua1023 edited this page Jun 20, 2024
·
6 revisions
In https://nsbox.local:9442/admin/repos, click "CREATE NEW", fill in the Repository name, and click the "CREATE" button:

On the page of the repository, you will find the clone URL:

Although the commit-msg hook is necessary for creating a code review in Gerrit, we recommend cloning the repository since the clone command with the commit-msg hook may not work correctly.
If you want to upload a commit to Gerrit, run:
git push origin HEAD:refs/for/master
Note the refs/for/master part. It is a special ref handled by Gerrit.
The first time when you run this command, it probably complains:
$ git push origin HEAD:refs/for/master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Processing changes: refs: 1, done
remote: ERROR: commit 0bece87: missing Change-Id in message footer
remote:
remote: Hint: to automatically insert a Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 admin@nsbox.local:hooks/commit-msg ${gitdir}/hooks/
remote: (for OpenSSH >= 9.0 you need to add the flag '-O' to the scp command)
remote: or, for http(s):
remote: f="$(git rev-parse --git-dir)/hooks/commit-msg"; curl -o "$f" https://nsbox.local:9442/tools/hooks/commit-msg ; chmod +x "$f"
remote: and then amend the commit:
remote: git commit --amend --no-edit
remote: Finally, push your changes again
remote:
To ssh://nsbox.local:29418/demo
! [remote rejected] HEAD -> refs/for/master (commit 0bece87: missing Change-Id in message footer)
error: failed to push some refs to 'ssh://nsbox.local:29418/demo'