Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a default branch in GitLab?

Tags:

git

gitlab

I am not able to push code to GitLab for the first time.

I have created a Gitlab project on the web interface.
I have created an ASP MVC project.
I did "git init" in that directory.
I added remote origin.
I added and committed the changes and then, when I want to push the changes to remote I get the following error:

remote: A default branch (e.g. master) does not yet exist for
...
remote: Ask a project Owner or Maintainer to create a default branch:
...
error: failed to push some refs to

So I want to know if I can create a branch with the role Developer?
If yes how to create a default branch?
If no, what should my next steps be?

like image 570
Mukesh Mahadev Avatar asked Apr 02 '20 04:04

Mukesh Mahadev


People also ask

What is the default branch in GitLab?

When you create a new project, GitLab sets master as the default branch for your project. You can choose another branch to be your project's default under your project's Settings > General.

Does Git have a default branch?

The default branch name in Git is master . As you start making commits, you're given a master branch that points to the last commit you made.


1 Answers

This is followed by issue 54155

It seems as though 'developer' should not be able to create projects if it does not have permission to then populate that project without asking an admin to intervene.

I don't understand, why I have enough permissions to create a project, but not to make it ready enough so I can push into it, and need to use another persons time in my organization to get ready to work.

IMHO it would be logical to either allow users with status developer to create a project in a way that it's ready to push code to - or just don't let developers create a project and tell them they have to ask a maintainer or owner.

Issue 51688 mentions:

Then I have to login with gitlab admin admin...Aggregate access to user test to test6.git as a dev or maintainer... and finally I can make push... But if user test creates another repo, I have to repeat all these steps again....

Maintainer can create new branch. Please use maintainer account to push the new project.

But it doesn't make sense that a user has permissions to create empty repositories but not initialize a default branch or push to their newly created repository.

like image 96
VonC Avatar answered Sep 28 '22 02:09

VonC