git push 错误处理
2017-04-19 本文已影响62人
请你吃糖
** 错误信息 **
错误1
fetch failed
cannot lock ref 'refs/remotes/origin/feature/xxx': unable to create lock file .git/refs/remotes/origin/feature/xxx.lock; non-directory in the way
错误2
Fetch failed: cannot lock ref 'refs/remotes/origin/Feature': there is a non-empty directory '.git/refs/remotes/origin/Feature' blocking reference 'refs/remotes/origin/Feature'
分析:
由于远程分支删除,导致本地ref指向的remote 分支不存在,fetch不匹配,从而报错
解决方法:
// 回收
git gc --prune=now
//更新remote
git remote update --prune
//删除报错的路径
rm -rf .git/refs/remotes/