Allow first push on a bare protected branch project

A customer raised this issue in a ticket and I'm including their notes below. Essentially, If you create a project and have protected branches on by default, no-one besides the master can create the initial commit. We tried setting the default to "partially protected" but then the Master branch didn’t change to protected afterwards. It seems to have defaulted to an unprotected branch.

The customer is looking for this kind of workflow:

  • A new project is created (completely empty)
  • Developers are added to the project
  • A developer creates the initial commit (README.md and/or other files) and then pushes
  • The push creates the master branch with the initial commit, and then sets master so that future pushes must be done either by master or merge request
  • A developer attempts to push to master branch again – but it fails because it’s now protected

I've been mulling over some ways to make this work and it's tricky because it's permissions (as always a tricky concept) but wanted to log it and open up a greater discussion.

Assignee Loading
Time tracking Loading