Document that first push needs owner or master permission

Summary

When you create a repository on GitLab, command line instructions on its home page for the use case "Existing folder or Git repository" invite you to git push -u origin master, but the very first push is now rejected.

Steps to reproduce

  • Create a new repository
  • Try to populate it from an existing folder on your local computer following the instructions on this empty repository homepage
  • git push -u origin master will trigger the error

Getting on the /protected_branches path of the repository is helpless, as without any branch you are being redirected to the repository home page.

Expected behavior

The very first push when the repository is completely empty should be authorized, and the master branch automatically protected after this first push, as it used to be.

Actual behavior

It's impossible to populate the inexisting master branch on the new repository as the pre-receive hook declines the push, and it's impossible to configure the /protected_branches for this new repository as none exists...

Relevant logs and/or screenshots

# git push -u origin master
Counting objects: 180, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (147/147), done.
Writing objects: 100% (180/180), 2.97 MiB | 1.45 MiB/s, done.
Total 180 (delta 9), reused 0 (delta 0)
remote: GitLab: You are not allowed to push code to protected branches on this project.
To git@my.gitlab-instance.com:group/project.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@my.gitlab-instance.com:group/project.git'

Output of checks

Results of GitLab application Check

Checking GitLab Shell ...

GitLab Shell version >= 3.6.0 ? ... OK (3.6.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
18/1 ... ok
... etc ... Insanely long text cut : all showing ok, I promise !
86/156 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... no
  Try fixing it:
  sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
  For more information see:
  doc/install/installation.md in section "GitLab"
  Please fix the error above and rerun the checks.
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
18/1 ... yes
... etc ... Insanely long text cut : all showing yes, I promise !
86/156 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 58

Checking GitLab ... Finished

Results of GitLab environment info

System information
System:		Debian 8.6
Current User:	git
Using RVM:	no
Ruby Version:	2.3.1p112
Gem Version:	2.6.6
Bundler Version:1.13.1
Rake Version:	10.5.0
Sidekiq Version:4.1.4

GitLab information
Version:	8.12.0
Revision:	0864ff9
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		http://my.gitlab-instance.com
HTTP Clone URL:	http://my.gitlab-instance.com/some-group/some-project.git
SSH Clone URL:	git@my.gitlab-instance.com:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

GitLab Shell
Version:	3.6.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:		/opt/gitlab/embedded/bin/git

Possible fixes

Actually I'm trying to push the fix on a new repository but being rejected !

No, just kidding 😂, I wish I could help, but I'm afraid I can't even think about where to start 🤔