Bird
0
0

You tried to set the default branch name with git config --global init.defaultbranch main but new repos still use 'master'. What is the problem?

medium📝 Troubleshoot Q14 of 15
Git - Configuration and Aliases
You tried to set the default branch name with git config --global init.defaultbranch main but new repos still use 'master'. What is the problem?
AThe config key is case-sensitive; it should be <code>init.defaultBranch</code>
BYou need to restart your terminal for changes to apply
CYou must run <code>git init</code> with a special flag to use the new default
DThe default branch name cannot be changed globally
Step-by-Step Solution
Solution:
  1. Step 1: Check the config key spelling

    Git config keys are case-sensitive. The correct key is init.defaultBranch with a capital 'B'.
  2. Step 2: Understand why the setting didn't apply

    Using init.defaultbranch (lowercase 'b') creates a different config entry that Git ignores for default branch naming.
  3. Final Answer:

    The config key is case-sensitive; it should be init.defaultBranch -> Option A
  4. Quick Check:

    Config keys are case-sensitive in Git [OK]
Quick Trick: Check exact case of config keys [OK]
Common Mistakes:
  • Ignoring case sensitivity in config keys
  • Thinking terminal restart is needed
  • Believing default branch can't be changed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes