Branch mix-up

I’m trying to push a local repository to GitLab. The instructions said to use ‘git init --initial-branch-name=main’, but that apparently isn’t valid syntax. So I have a local branch named master, a remote branch named main and an unhelpful error from git.

So actually the syntax is git init --initial-branch=main. Going to check out how to rename local branches now. Would be nice to have the option of renaming the initial branch when I create a new project.

1 Like

Hi @jgedri

There is no branch in a new repository/project unless you click to create it with README.md. Name of the default branch can be set in your Projects Settings in Repository page.

As for the name of local branch the easiest is to just create new branch from a branch git checkout -b main master.