본문 바로가기

프로그램 경험/프로그램 정보

[GIT] remote: error: cannot lock ref, exists; cannot create

[GIT] exists; cannot create, remote: error: cannot lock ref





소스트리를 이용해서 Push를 하는 도중이 아래와 같은 오류가 발생했다.

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=manager-st push -v —tags origin Main/develop:Main/develop

Pushing to git@192.168.0.100:solutions/calc.git

remote: error: cannot lock ref 'refs/heads/Main/develop': 'refs/heads/Main' exists; cannot create 'refs/heads/Main/develop'        

To 192.168.0.100:solutions/calc.git

 = [up to date]        Interop_version -> Interop_version

 ! [remote rejected]   Main/develop -> Main/develop (failed to update ref)

error: failed to push some refs to 'git@192.168.0.100:solutions/calc.git'

Main이란 폴더 밑에 develop 브랜치를 만들고 Push 할 생각 이었는데 실수로 Main 브랜치를 만들고 그 하위에 develop 브랜치를 만들어 버렸다. 그걸 Push하려고 하니 발생한 오류다. 

해결책은 새로운 폴더/브랜치를 만들어서 Push하고 이전것은 지워 버리자.