Git and nasty “error: cannot lock existing info/refs fatal”

后端 未结 24 1474
礼貌的吻别
礼貌的吻别 2020-11-30 15:58

After cloning from remote git repository (at bettercodes) I made some changes, commited and tried to push:

git push origin master

Errors

24条回答
  •  长情又很酷
    2020-11-30 17:00

    I fixed this by doing the following

    git branch --unset-upstream
    rm .git/refs/remotes/origin/{branch}
    git gc --prune=now
    git branch --set-upstream-to=origin/{branch} {branch}
    #or git push --set-upstream origin {branch}
    git pull
    

    This assuming that your local and remote branches are aligned and you are just getting the refs error as non fatal.

提交回复
热议问题