Change default git push to origin HEAD:refs/for/master

82 Views Asked by At

I'm using VS Code and Gerrit. And anytime I'm trying push anything using the VS code GUI.

I have following error:

git push origin master:master remote: error: branch refs/heads/master:
remote: Push to refs/for/master to create a review, or get 'Push' rights to update the branch.
remote: User: user_name remote: Contact an administrator to fix the permissions
remote: remote: Processing changes: refs: 1
remote: Processing changes: refs: 1, done
To ssh://gerrit.company_name.co.uk:11111/SomeRepo ! [remote rejected] master -> master (prohibited by Gerrit: not permitted: update) error: failed to push some refs to 'ssh://gerrit.company_name.co.uk:11111/SomeRepo'

However everything works if I do it manually using the following command:

git push origin HEAD:refs/for/master

[Question]: How can I change git push origin master:master to git push origin HEAD:refs/for/master?

In the .gitconfig I've tried to add the following options, but it is still not working for me.

[remote "origin"]
fetch = +refs/heads/master:refs/remotes/origin/master
push = refs/heads/master:refs/for/master```
0

There are 0 best solutions below