大家好
最近開專案時,要PUSH時發生錯誤
 
 
git.exe push --force-with-lease --progress "origin" master:master

Counting objects: 903, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (877/877), done.
Writing objects: 100% (903/903), 16.59 MiB | 2.74 MiB/s, done.
Total 903 (delta 207), reused 0 (delta 0)
remote: Resolving deltas: 100% (207/207), done.
remote: GitLab: You are not allowed to push code to protected branches on this project.
To ssh://git@git.*********.com:999/zoearth/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@git.*********.com:999/zoearth/test.git'


git did not exit cleanly (exit code 1) (9344 ms @ 2017/3/1 下午 03:26:57)
 
 
發生錯誤 "You are not allowed to push code to protected branches on this project."
仔細研究一下,發現是跟第一次推送的分支有關,因為,GIT LAB預設第一次推送的分支是master,所以預設會是保護狀態
 
所以開專案者必須先 PUSH MASTER 分支之後才能PUSH後續其他分支,或是其他人PUSH,當然也可以解除保護,也OK。
給大家參考囉。