It seems that my local installation of git
(version 2.10.2) is such that whenever I issued git push
, it is interpreted as git push -f
. Is there a configuration variable that I could've set incorrectly to cause this behavior?
More background
Recently, the server I use upgraded their installation of GitLab (running community edition 8.14.2 b9442a5eb0, unfortunately, there's no easy way for me to find out what the previous version was). For every project that I own (and have master permission on), I get
[Tue Dec 06 02:21 PM] ArchDesktop $ git push
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 765 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
To REDACTED
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'REDACTED'
I assume this is due to the implementation of "protected branches" in more recent versions of GitLab. Now, I should be able to push stuff, since I have Master access to my own projects. Furthermore, if it were just permission issues, the error message, I understand, should read
remote: GitLab: You are not allowed to force push code to a protected branch
with no mentions of force pushing. So the question really is: why is Git trying to force push my commits when I didn't tell it to?
Even more background
Once upon a time I read up on how Git works and actually understood it. Then I started using it and have largely forgotten. It is therefore entirely possible that I am doing something completely wrong and not understanding it. I am not even sure how to diagnose this problem. So any comments on what I need to include to this question or what obvious things I should check are welcome!
Additional Info
As requested: git config --list
gives only (in addition to my name, email and the URL of the repo)
user.name=*******
user.email=******
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=**************
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
Slightly redacted output of GIT_TRACE=1 git push
:
09:13:50.859273 git.c:349 trace: built-in: git 'push'
09:13:50.859524 run-command.c:336 trace: run_command: 'ssh' 'git@gitlab.REDACTED' 'git-receive-pack '\''REDACTED.git'\'''
09:13:54.097551 run-command.c:336 trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
09:13:54.098218 exec_cmd.c:120 trace: exec: 'git' 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
09:13:54.100884 git.c:349 trace: built-in: git 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 389 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
To REDACTED
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'REDACTED'
git pull
prior to yourgit push
and perhaps also have you unprotectedmaster
to see what happens? I agree that the error message is weird if you are not explicitly usinggit push -f
? – Giacomo1968 Dec 6 '16 at 19:41master
it works as stated; so the issue really is with the branch being protected.git pull
tells me it is already up to date. – Willie Wong Dec 6 '16 at 19:44