✓ Works

git ≥ 2.28: init.defaultBranch Configuration Available

git ≥ 2.28 + init.defaultBranch configuration

`init.defaultBranch` was introduced in git 2.28.0 (July 2020). It allows configuring the default branch name for new repositories (e.g. set to `main` instead of `master`). Set globally with `git config --global init.defaultBranch main`. git versions before 2.28 always create `master` regardless of config.

Related Error Pages

Related Combinations

git 2.43 + Ubuntu 24.04 LTS ✓ Works git 2.34 + Ubuntu 22.04 LTS ✓ Works git (latest, via Homebrew) + macOS (any supported) ✓ Works git for Windows (latest) + Windows 10 / 11 ✓ Works
Last verified: 2024-06-01  ·  Category: git + OS / Features