这不是复制品。我看过this stack overflow post和this post,并尝试了他们的解决方案,但没有奏效。
我正在使用Ubuntu16.04,并试图将一个项目推送给Github。
当我跑步时:
git push jr master
我知道这个错误:
error: update_ref failed for ref 'refs/remotes/jr/master': cannot lock
ref 'refs/remotes/jr/master': Unable to create
'/home/john/Desktop/john-rykken-V2/.git/refs/remotes/jr/master.lock':
File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Everything up-to-date我运行了以下命令:
rm -f .git/refs/heads/master.lock
rm -f .git/index.lock两样都没用。我还重新启动了我的机器并运行了ps -a | grep git,但是没有发现任何正在运行的进程。最后,当我进入我的项目目录并手动搜索master.lock时,我找不到它。
有什么建议吗?我的下一步是重新克隆存储库。
发布于 2018-09-14 02:00:48
您可能已经使用sudo运行了git命令,这导致了.git存储库中的一些文件为root所有。尝试运行以下命令,将存储库中所有文件的所有权更改为您的用户:
sudo chown -R john /home/john/Desktop/john-rykken-V2/.git我在这里假设您正在尝试与用户john一起运行git。否则,将其更改为正确的用户。
编辑:
事实证明,错误消息上的文件必须被删除:rm -f .git/refs/remotes/jr/master.lock
https://stackoverflow.com/questions/52323860
复制相似问题