Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been away from using GitLab for about a month while I've been on vacation and the first time I tried to push a change to my Blog's code, I received the following error:
 Git push error
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v origin refs/heads/master:refs/heads/master
Pushing to [email protected]:user/myrepository.git
remote: GitLab: You are not allowed to push code to protected branches on this project.
To [email protected]:user/myrepository.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:user/myrepository.git'
Completed with errors, see above


This error came up every time I tried to do a push using SourceTree. I didn't try the command line client.

I figured this was a little odd since I am the master (owner) of this private repository and even though it was a protected branch according to my GitLab settings, I should have been able to push changes to it.
gitlabprotected.png


I logged into the GitLab website and checked whether I had any web hooks configured and I didn't, so that couldn't have been the problem.

I tried doing a push again and all of a sudden it worked! So I am guessing that logging into the GitLab website had reset my login session or something and let me do a push to my repository.



-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.