Default git branch name is master not main on MacOS
Problem
On MacOS Sequoia 15.0.0, cargo init will create a project with git initialized but the default branch name is "master" instead of "main".
Steps
- Install the latest Rust toolchain on MacOS Sequoia 15
cargo initan empty project- Check the default branch name with
git status.
Possible Solution(s)
Manually modify the name of the branch.
Notes
No response
Version
cargo 1.81.0 (2dbb1af80 2024-08-20) release: 1.81.0 commit-hash: 2dbb1af80a2914475ba76827a312e29cedfa6b2f commit-date: 2024-08-20 host: aarch64-apple-darwin libgit2: 1.8.1 (sys:0.19.0 vendored) libcurl: 8.7.1 (sys:0.4.73+curl-8.8.0 system ssl:(SecureTransport) LibreSSL/3.3.6) ssl: OpenSSL 1.1.1w 11 Sep 2023 os: Mac OS 15.0.0 [64-bit]
Could you try git init and see which branch name it creates?
You might also like to check in your fit config files the init.defaultBranch value.
This seems like an upstream issue: https://github.com/libgit2/libgit2/issues/6883.
It might be either you don't have Apple Command-line Tools installed, or they removed the default git configuration in Sequoia. Either way, this seems to be out of control of Cargo. Cargo generally respects what libgit2 does to configuration.
Could you try
git initand see which branch name it creates? You might also like to check in your fit config files theinit.defaultBranchvalue.
git init creates a main branch not master.
-> % git config --get init.defaultbranch
main
As for the libgit issue, I have a similar output.
-> % git config --show-origin --show-scope --list
unknown file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain
unknown file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig init.defaultbranch=main
global file:/Users/songyang/.gitconfig user.name=Song Yang
...