[Git/깃허브] error: src refspec main does not match any

sbj·2023년 11월 24일
0

ERROR.zip

목록 보기
4/19
post-thumbnail

Problem (문제)

An error occurred when trying to create a new repository and push it.
새로운 Repo를 생성하고, push 하려하자 발생한 에러.

You may get this error when you try to trigger a push from a local repository to a main repository like this.
로컬 Repo → Main Repo로 push하려 할 때 이런 에러를 마주할 것이다.

git push -u origin main

Cause (원인)

This error can occur for different reasons. The most likely reason this error will occur is that the main branch does not exist.
이 에러는 여러 이유로 발생할 수 있는데, 가장 가능성있는 이유는 ‘Main’ 브랜치가 존재하지 않기 때문임.


Solution (해결법)

$ echo "# repository" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main
$ git remote add origin https://github.com/profile/repository.git
$ git push -u origin main

The issue was resolved by following the usual push procedures.
기존 push 절차대로 수행해주었더니, 해결되었다.

profile
Strong men believe in cause and effect.

0개의 댓글