Using git through wsl (ubuntu) & windows terminal, how do you change the default branch name to main?
I've already tried:
git config --global init.defaultBranch main
and the setting "init.defaultbranch=main" is there when I look at:
git config --global --list
but when I try to make a new git init in a brand new folder it still uses master... Any ideas?
So it turns out you need git version 2.28 or higher. I had git version 2.25.1 even though I just installed git a few months ago. For Ubuntu it seems you have to jump through a few hoops to get the lastest version.
This is what I tried
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
After that you can check your version using:
git --version
If you added the global setting in the code from my question you should be good to go.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.