git在master上推送报错解决办法

问题场景:不小心在主干上开发后,然后在主干上直接提交,但是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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,277评论 25 709
  • 在日常的教育教学管理和教育教学实践中,各级教育管理机构和规划部门以及学校的教育科研研究人员在对一些教育教学...
    HannahMerryn阅读 4,829评论 0 0
  • 睡觉前,我撇了一眼褶皱的窗帘,突然想起来还是你帮我搭好的。 这两个月,每一天,无不是都是这样这样过来的,尽管很多时...
    马小六六阅读 3,493评论 0 0
  • 人啊,有的时候很无奈,有很多说不出来的痛苦,而造就痛苦的不是人的本身就是人的周围的人和事,怎么解决这些痛苦呢,除了...
    46039dc5ef8d阅读 1,027评论 0 1
  • 为什么我们为人越来越小心? 为什么我们处世越来越谨慎? 生活处处是陷阱, 不知哪一次就陷入绝境; 现实次次是深坑,...
    股韵奇谈阅读 1,436评论 0 0