공부/git

git init를 하면 hint 메세지가 나올때

inSaPPoRo 2022. 1. 14. 17:55

시작하며

언제부턴가 git를 초기화하면 힌트라고 몇줄 쫙나오는데 귀찮아서 그냥 두다가 오늘 정리했습니다.

원인

git init
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 <name>
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 <name>
Initialized empty Git repository in /Users/XXXX/XXXXX/.git/

힌트에 써있듯이 기본 브런치를 설정하라는 것 같습니다.

init.defaultBranch 값을 확인해 보겠습니다.

$ git config --global init.defaultBranch

아무것도 안나옵니다.

해결방법

기본 브런치 master에 대한 논란이 있어서 main으로 한다는 소리가 있으므로 main을 기본 브런치로 하겠습니다.

$ git config --global init.defaultBranch main

init.defaultBranch 값을 확인하니 main으로 나오네요

마치며

git init를 하면 여러줄 나오는게 없어졌네요.

반응형