First, modify code in client and submit into local git repository

$ git branch

*master

$ git diff

diff --git a/README b/README

index 73e05f6..a055fa1 100644

--- a/README

+++ b/README

@@ -7,4 +7,6 @@Third change

.....

+This is my change for a demo

+

$ git add README

$ git commit -m "Demo change"

[master 6e24386] Demo change

1 file changed, 2 insertions(+)

$ git log

commit ec68f4debba8b3f23848a36b48b5d202c31a514a

Author:杨海<[email protected]>

Date: Mon Jul 3 11:07:26 2017 +0800

Demo change

Change-Id: If9242938a6bcd858a3f9135c127ef435966039bf

The last Change-Id is very import. You cannot push CL into gerrit server without it.

Next,push CL into gerrit server by 'git push origin HEAD:refs/for/<branch name>'

$git push origin HEAD:refs/for/master

对象计数中: 3,完成.

Delta compression using up to 8 threads.

压缩对象中: 100% (2/2),完成.

写入对象中: 100% (3/3), 361 bytes | 0 bytes/s,完成.

Total 3 (delta 0), reused 0 (delta 0)

remote: Processing changes: new: 1, refs: 1, done

remote:

remote: New Changes:

remote:http://gerrit.yuneec.com:8100/7 Demo change

remote:

To ssh://gerrit.yuneec.com:29418/Example

* [new branch] HEAD -> refs/for/master

You can open the URL with web browser to review the CL.

http://gerrit.yuneec.com:8100/7

⚠️ Please check ToubleShooting, if you have problem to push CL to gerrit.

https://www.gitbook.com/book/haiyanghaiyang/gerrit-user-manual/edit#/edit/master/trouble-shooting.md?_k=uiqa0n

If any CL need by modified,

  1. If this CL is merged or abandoned in gerrit, you cannot modify and push it again. You have to commit a new CL locally, and push that to gerrit.
  2. If this CL is not merged in gerrit, you can modify it locally and push it into gerrit again. After submit, gerrit generates patch set 2 in the same URL. New CL can be pushed continuously as patch set 3, 4, 5 etc, before it is merged or abandoned.

$git commit --amend

$git push origin HEAD:refs/for/master

If there is new CL merged in gerrit with same content of this CL,server will ask you rebase first before push it.

git commit --amend

$git rebase origin/master

$git push origin HEAD:refs/for/master

⚠️ Push CL to remote branch directly without gerrit review is forbidden.
$ git push origin HEAD:refs/heads/master

对象计数中: 6, 完成.

Delta compression using up to 8 threads.

压缩对象中: 100% (4/4), 完成.

写入对象中: 100% (6/6), 600 bytes | 0 bytes/s, 完成.

Total 6 (delta 1), reused 0 (delta 0)

remote: Resolving deltas: 100% (1/1)

remote: Branch refs/heads/master:

remote: You are not allowed to perform this operation.

remote: To push into this reference you need 'Push' rights.

remote: User: hai.yang

remote: Please read the documentation and contact an administrator

remote: if you feel the configuration is incorrect

remote: Processing changes: refs: 1, done

To ssh://gerrit.yuneec.com:29418/Example

! [remote rejected] HEAD -> master (prohibited by Gerrit: ref update access denied)

error: 无法推送一些引用到 'ssh://gerrit.yuneec.com:29418/Example'

Here is the difference between refs/heads/* and refs/for/*.If you want to push CL for review, please push it to refs/for/<branch name>. If you want to push CL to remote branch directly, please push it to refs/heads/<branch name>. Push to branch directly without review is not allowed as above. This permission is provided to administrators and integrators only.

results matching ""

    No results matching ""