Remark : Debugging : src refspec main does not match any (last update: 2020.12.18.)

devpark·2020년 12월 18일
0

1-1. Git : src refspec main does not match any

Notion의 Debugging & Problem Solving 통합 페이지 바로가기


0. References

Stackoverflow - Message 'src refspec master does not match any' when pushing commits in Git


1. Introduction

Github에 새로운 Repository를 생성하고 초기화 후 첫 commit 및 push를 날릴 때, Terminal에서 src refspec main does not match any라는 에러 메세지가 도출되는 문제의 디버깅에 대해 기술한다.


2. Problem

  1. git Repository를 생성하면 화면에 다음과 같은 command line을 입력하라는 내용이 보인다:
    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
  1. 위의 내용을 VS Code의 Terminal에 입력하고, git push -u origin main를 입력할 때 src refspec main does not match any라는 에러 메세지가 확인되며, push가 진행되지 않는다.

3. Solve

이는 add 후 commit이 되지 않았기 때문이다.

git add .을 Terminal에 입력하여 파일들을 add 해준 후, git commit -m "COMMIT MESSAGE ON HERE"하여 add한 파일들을 commit 해 준다. 이후, 다시 git push origin master 해 주면 정상적으로 push가 된 것을 확인할 수 있다!


profile
아! 응응애에요!

0개의 댓글