Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default git branch name is master not main on MacOS #14650

Open
songyang-dev opened this issue Oct 7, 2024 · 3 comments
Open

Default git branch name is master not main on MacOS #14650

songyang-dev opened this issue Oct 7, 2024 · 3 comments
Labels
A-git Area: anything dealing with git C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@songyang-dev
Copy link

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

  1. Install the latest Rust toolchain on MacOS Sequoia 15
  2. cargo init an empty project
  3. 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 (2dbb1af 2024-08-20)
release: 1.81.0
commit-hash: 2dbb1af
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]

@songyang-dev songyang-dev added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Oct 7, 2024
@weihanglo
Copy link
Member

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.

@weihanglo weihanglo added A-git Area: anything dealing with git S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Oct 7, 2024
@weihanglo
Copy link
Member

This seems like an upstream issue: libgit2/libgit2#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.

@weihanglo weihanglo added S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. labels Oct 7, 2024
@songyang-dev
Copy link
Author

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.

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
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

2 participants