Skip to content

git push error when not maintainer: A default branch (e.g. main) does not yet exist

Summary

Steps to reproduce

  1. create a empty project(role: not maintainer)
  2. git push

Example Project

https://jihulab.com/jihulab/presales/why-gitlab

What is the current bug behavior?

push failed

What is the expected correct behavior?

push success

Relevant logs and/or screenshots

image

remote: Resolving deltas: 100% (74/74), done.
remote: GitLab:
remote: A default branch (e.g. main) does not yet exist for jihulab/presales/why-gitlab
remote: Ask a project Owner or Maintainer to create a default branch:
remote:
remote:   https://jihulab.com/jihulab/presales/why-gitlab/-/project_members
remote:
To jihulab.com:jihulab/presales/why-gitlab.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'jihulab.com:jihulab/presales/why-gitlab.git'

Possible fixes

notice: need permission