[Github] default branch name change

2023. 2. 15. 22:57trouble shoot

github 의 default branch 이름이 master 에서 main 으로 변경되었는데 모르고 있었다.

 

뒷북이지만 2022년 10월 1일 공지되었는데 Black Lives Matter 의 사회적 이슈 제기로

https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/

 

master 단어 대신 main 으로 변경되었다고 한다.. 

 

 

 

아래 그림은 git init 으로 생성된 default 브랜치가 master 로 생성된 상태에서

github에 생성한 저장소로 push 하니 main 브랜치에 반영할게 없다고 에러가 발생한 화면이다.

branch main or master

해결 방법

  1. .git 폴더를 삭제
  2. git init 명령어 사용시 생성되는 default branch 이름을 변경
  3. default branch 변경이 제대로 되었는지 확인
$ git config --global init.defaultBranch main
$ git config --get init.defaultbranch

git init default branch change