[Git] Git pull 에러 모음

Jenna·2023년 3월 9일
0

1. Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched.

local branch가 remote에 존재하지 않아서 발생하는 에러


해결방법

git remote update

remote 에서 브랜치 받아오기 위해 update


git branch -a

branch 확인


git checkout -t <branch name>

remote branch를 local로 가져오기


git checkout <branch name>

branch 전환


++ 나같은 경우에는 맨날 기본 branch 설정이 master로 되어있어서 발생하는 오류..

git의 기본설정은 main이다.

(원래는 master 였다가 바뀌어서 그런 듯 -> github는 평등을 지향하기 때문에 master라는 기본 branch name은 master와 slave를 연상시킨다고 main으로 기본 branch name을 변경함
아무도 안궁금할수도 있지만 재밌는 이야기라서.. 머쓱)

git branch -m master main

위 명령어로 기본 브랜치를 맨날 바꿔줄수도 있지만 한번 바꿔놓으면 편하기 때문에 편의성을 위해서 기본 브랜치 자체를 변경해보겠다.


2. 기본 브랜치 main으로 설정하기

git config에서 설정해준다

git config --global init.defaultBranch main

global 옵션으로 실행


git config --get init.defaultBranch

명령어로 기본 branch 확인하기

main

으로 뜨면 설정된 것

git init 으로 실행하면 기본 branch가 main으로 설정된다.

profile
FE/Game Dev.

0개의 댓글