error: src refspec main does not match any 는
보통 push 하려는 branch 이름이 실제로 존재하지 않거나, 아직 commit이 하나도 없을 때 발생한다.
git push -u origin main
error: src refspec main does not match any보통 아래 경우이다.
- 아직 첫 commit을 안 한 상태
- 현재 branch 이름이
main이 아닌데main으로 push 한 경우 - branch 이름을 잘못 입력한 경우
git branchgit log --onelinegit statusGit은 commit이 하나도 없으면 push 할 branch 기록 자체가 없다.
git add .
git commit -m "INIT: first commit"
git branch -M main
git push -u origin main예를 들어 현재 branch가 master 인데 main 으로 push 하면 에러가 난다.
git branchgit push -u origin mastergit branch -M main
git push -u origin maingit status
git branch
git add .
git commit -m "INIT: first commit"
git branch -M main
git push -u origin main이 에러는
push 하려는 branch가 실제로 없거나, 아직 commit이 없어서 Git이 올릴 대상을 못 찾는 상태이다.