我有一个要转换为git项目的目录。
我在gitlab中创建了一个新项目,然后执行了以下操作:
git init
git remote add origin git@gitlab.com:a/b/c.git
git add .
git commit -m "Initial commit"
git push -u origin master
此外,我创建了以下.gitignore
文件:
*
!*/scripts
!*/jobs
运行git push -u origin master
后,出现以下错误:
Counting objects: 33165, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (32577/32577), done.
Writing objects: 100% (33165/33165), 359.84 MiB | 1.70 MiB/s, done.
Total 33165 (delta 21011), reused 0 (delta 0)
remote: Resolving deltas: 100% (21011/21011), done.
remote: GitLab:
remote: A default branch (e.g. master) does not yet exist for a/b/c
remote: Ask a project Owner or Maintainer to create a default branch:
remote:
remote: https://gitlab.com/a/b/c/project_members
remote:
To gitlab.com:a/b/c.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.com:a/b/c.git'
可能是什么问题? 请指教
答案 0 :(得分:5)
这链接到issue 27456和merge request 6608:
文档说明所有者或拥有初始推送的主权限级别
所以它可能是权限级别,而不是分支问题。
请参见commit 81ee443:
由于主分支将自动受到保护,因此您必须是所有者或拥有初始推送的主许可级别。