无法将文件推送到 git,原因是:未能推送一些 refs [英] Unable to push files to git due to: failed to push some refs

查看:50
本文介绍了无法将文件推送到 git,原因是:未能推送一些 refs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a directory that i want to turn into a git project.

I created a new project in gitlab and then i did the following:

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

In addition, I created the following .gitignore file:

*
!*/scripts
!*/jobs

After running git push -u origin master i got the following error:

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'

What could be the issue? Please advise

解决方案

This is linked to issue 27456 and merge request 6608:

document the need to be owner or have the master permission level for the initial push

So it might be a permission level, not a branch issue.

See commit 81ee443:

You will need to be owner or have the master permission level for the initial push, as the master branch is automatically protected.

这篇关于无法将文件推送到 git,原因是:未能推送一些 refs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆