프로젝트 협업 과정 중 작업한 내용을 push하려는 과정에서
이와 같은 에러로 push가 되지 않았다.
error: src refspec dev does not match any
error: failed to push some refs to
구글링한 방법으로 해결이 안될 경우
local branch 목록과 remote branch 목록을 조회한 후 로컬과 원격브랜치의 이름이 동일한지 확인해봐야한다.
나의 local branch 확인 명령어:
git branch
현재 연결된 원격저장소의 브랜치목록 확인 명령어(remote branch):
git branch -r
이런 경우 로컬과 원격브랜치를 연동해주는 명령어인
git branch --set-upstream-to xxx/xxx
를 쓰더라도 push가 되지않는다.
ex)
나의 local branch 목록:
main
local
remote branch 목록:
main
dev
로컬 브랜치와 원격브랜치의 이름이 맞지않기떄문에 동일하게 맞춰줘야한다.
위 예제에서 질척거리는 local branch는 없애버리고
새롭게 local branch를 만들어서 연결해보자. 새삥~!
local branch 생성:
git branch <브랜치이름>
local branch 삭제:
git branch -d <브랜치이름>
새로 생성한 브랜치로 로컬환경의 작업브랜치 변경
git checkout <브랜치이름>
새로 생성한 브랜치와 원격브랜치 연동
git branch --set-upstream-to xxx/xxx
ex) git branch --set-upstream-to origin/dev
(원격저장소이름/푸시할 원격저장소 브랜치)
연동한 뒤 Push 명령어
git push
많은 도움이 되길바랍니다.