Notion의 Debugging & Problem Solving 통합 페이지 바로가기
Stackoverflow - Message 'src refspec master does not match any' when pushing commits in Git
Github에 새로운 Repository를 생성하고 초기화 후 첫 commit 및 push를 날릴 때, Terminal에서 src refspec main does not match any
라는 에러 메세지가 도출되는 문제의 디버깅에 대해 기술한다.
git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/foo/bar.git git push -u origin main
git push -u origin main
를 입력할 때 src refspec main does not match any
라는 에러 메세지가 확인되며, push가 진행되지 않는다.이는 add 후 commit이 되지 않았기 때문이다.
git add .
을 Terminal에 입력하여 파일들을 add 해준 후, git commit -m "COMMIT MESSAGE ON HERE"
하여 add한 파일들을 commit 해 준다. 이후, 다시 git push origin master
해 주면 정상적으로 push가 된 것을 확인할 수 있다!