-
[Git]error: src refspec main does not match any & error: failed to push some refs to 'https://github.com/.git'2025년 01월 02일
- 21V
-
작성자
-
2025.01.02. :00
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/사용자명/프로젝트_이름.git'error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/사용자명/프로젝트_이름.git'이 오류는 일반적으로 로컬 브랜치에 커밋이 없거나, 브랜치 이름과 원격 브랜치 이름이 일치하지 않을 때 발생한다.
"src refspec main does not match any" 및 "failed to push some refs" 오류 해결
이 오류는 로컬 브랜치에 커밋이 없거나, 브랜치 이름이 원격 브랜치와 일치하지 않을 때 발생합니다. 이를 해결하려면 아래 단계를 따르세요:
1. 변경 사항 추가
현재 디렉토리의 모든 파일을 Git 스테이지에 추가합니다:
git add .
2. 첫 커밋 생성
커밋 메시지를 작성하여 커밋을 만듭니다:
git commit -m "Initial commit"
3. 원격 저장소로 푸시
로컬 브랜치(
main
)를 원격 브랜치로 푸시합니다:git push -u origin main
4. 브랜치 이름 확인 및 설정 (필요 시)
만약 로컬 브랜치와 원격 브랜치 이름이 일치하지 않는다면, 로컬 브랜치 이름을 변경하세요:
git branch -m <원격 브랜치 이름>
예를 들어, 원격 브랜치 이름이
main
이라면:git branch -m main
그런 다음, 다시 푸시를 시도하세요:
git push -u origin main
'Trouble Shooting > GIT' 카테고리의 다른 글
[Git]fatal: a branch named ' ' already exists (0) 2025.01.02 [Git]error: remote origin already exists. (0) 2025.01.02 [Git]fatal: couldn't find remote ref main (0) 2025.01.02 다음글이전글이전 글이 없습니다.댓글
스킨 업데이트 안내
현재 이용하고 계신 스킨의 버전보다 더 높은 최신 버전이 감지 되었습니다. 최신버전 스킨 파일을 다운로드 받을 수 있는 페이지로
이동하시겠습니까?
("아니오" 를 선택할 시 30일 동안 최신 버전이 감지되어도 모달 창이
표시되지 않습니다.)