Admin cannot push into empty repository of a project they're not a member of

The following discussion from !16547 (merged) should be addressed:

  • @dbalexandre started a discussion: (+16 comments)

    I tried your branch locally using the HTTP protocol the project creation succeed, but the push fails, see:

    ~/Sandbox/repositories/project-1 master
    ❯ git push --set-upstream http://localhost:3000/douglas/project-1.git master
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 237 bytes | 237.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: GitLab: You are not allowed to push code to protected branches on this project.
    To http://localhost:3000/douglas/project-1.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'http://localhost:3000/douglas/project-1.git'

\cc @DouweM

Edited by Douwe Maan