Error Initialize GIT git init --initial-branch=main

From KoanSoftware Wiki
Revision as of 09:50, 2 August 2023 by Koan (talk | contribs) (Created page with "== Error Initialize GIT git init --initial-branch=main == When initializing a new repository with old syntax you may face to this error > git init --initial-branch=main er...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Error Initialize GIT git init --initial-branch=main

When initializing a new repository with old syntax you may face to this error

> git init --initial-branch=main
error: unknown option `initial-branch=main'

Example of Gitlab suggested regular code

cd existing_folder
git init --initial-branch=main
git remote add origin git@gitlab.com:path/to/project.git
git add .
git commit -m "Initial commit"
git push -u origin main


Fix the problem using this way

cd existing_folder
git init
git checkout -b  main
git remote add origin git@gitlab.com:path/to/project.git
git add .
git commit -m "Initial commit"
git push -u origin main