[git] Why is git push gerrit HEAD:refs/for/master used instead of git push origin master

I've just started using gerrit and I want to know why we need to do git push gerrit HEAD:refs/for/master instead of doing git push origin master

If I do git push origin master I get the error saying ! [remote rejected] master -> master (prohibited by Gerrit)

This question is related to git gerrit

The answer is


In order to avoid having to fully specify the git push command you could alternatively modify your git config file:

[remote "gerrit"]
    url = https://your.gerrit.repo:44444/repo
    fetch = +refs/heads/master:refs/remotes/origin/master
    push = refs/heads/master:refs/for/master

Now you can simply:

git fetch gerrit
git push gerrit

This is according to Gerrit