git init 出现 Using ‘master‘ as the name for the initial branch. This default branch name报错

当我们在一个目录下初始化git时 可能会出现这个报错,

$ git init
warning: templates not found in /home/ja/share/git-core/templates
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch 
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m 
Initialized empty Git repository in /tmp/new/.git/

一般情况下 我们先设置默认分支为master级别 

git config --global init.defaultBranch master

 这是我出现这个问题后,Google一下找到的解决方案,希望能帮助到有需要的人。

参考链接:how to disable git message about git initial branch name - Stack Overflow 

你可能感兴趣的:(git,github)