프로그래밍/Github

[Github] 깃허브 에러 - branch checkout error : pathspec did not match any file(s) known to git 해결

연유뿌린빙수 2024. 12. 31. 01:54

git checkout branch 도중 에러가 발생했다.

작업 중이던 브랜치가 github 원격에서의 브랜치와 다르거나,

브랜치로 checkout을 하려고 했는데 현재 있던 branch가 원격과 다르기 때문에 오류가 발생하는 것이다.

 

에러 메세지

error: pathspec ['branch 이름'] did not match any file(s) known to git

원인 : 로컬 저장소의 git과 원격 저장소의(remote) git 정보가 동기화되지 않아 생긴 오류이다

 

해결 방안

git remote update
git checkout [브랜치명]

remote(원격) 버전으로 update를 하고 난 후에 전환하고싶은 브랜치로 전환이 가능해진다.