问题场景:不小心在主干上开发后,然后在主干上直接提交,但是push时产生冲突
wgx-2:ydl wgx$ git push origin master
Counting objects: 18, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (17/17), done.
Writing objects: 100% (18/18), 2.93 KiB | 0 bytes/s, done.
Total 18 (delta 15), reused 0 (delta 0)
remote: error: cannot lock ref 'refs/heads/master': Unable to create '/ndiskd/repositories/li/best/wgx.git/refs/heads/master.lock': File exists.
remote:
remote: If no other git process is currently running, this probably means a
remote: git process crashed in this repository earlier. Make sure no other git
remote: process is running and remove the file manually to continue.
To https://git.oschina.net/best/wgx.git
! [remote rejected] master -> master (failed to update ref)
error: failed to push some refs to 'https://git.oschina.net/best/wgx.git'
当遇到上面的问题,执行下面命令删除index.lock,再push即可
rm -f ./.git/index.lock
git push origin master
网友评论