社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

Git桌面:正确同步时出现问题(lock ref)

payne • 5 年前 • 1678 次点击  

几个月来,我经常在取货时发现这个错误(或类似的错误)。

我该怎么解决?这是什么原因?这是一步一步发生的事情。

取回之后:

error: cannot lock ref 'refs/remotes/origin/master': is at 1b8080a7ad8afa75a919feabeae31a8846763b73 but expected 67f1a4d428b7ab46a0fa62b4bb0d920592f920d9
From https://github.com/payne911/UdeM
 ! 67f1a4d..1b8080a  master     -> origin/master  (unable to update local ref)

error

在第一个弹出窗口中单击“关闭”后:

close

在第二个弹出窗口中单击“关闭”后:

closing

按“拉原点”:

error: Your local changes to the following files would be overwritten by merge:
    Trimestre_4/IFT3325_Teleinfo/devoirs/2/class_diag.png
Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
    Trimestre_4/IFT3913_Qual_Metr/TP/3/~$apport.docx
Please move or remove them before you merge.
Aborting

enter image description here

所以现在这些文件实际上被提取了,但还没有全部?尽管我仍然可以点击“pull”按钮,但显然没有被拉出来,它们现在看起来好像是我在这台计算机上做的修改,我需要提交它们?奇怪!

我提交并按下“拉原点”:

error: unable to unlink old 'Trimestre_4/IFT3325_Teleinfo/devoirs/2/rapport_tp2.docx': Invalid argument

enter image description here

那个文件甚至都不在提交的文件中!尽管它确实被打开了。我把它关上,又按了一下按钮:

enter image description here

注意,我已经成功地提交了不是我的部分更改的更改。现在我设置了一个“合并提交”。然后按“推”键不会出错,我就恢复正常了。

enter image description here

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/40517
 
1678 次点击  
文章 [ 1 ]  |  最新文章 5 年前
VonC
Reply   •   1 楼
VonC    6 年前

首先,在windows上,确保没有一个活动进程,该进程将保留git管理的一个文件的句柄。这将解释错误消息的第二部分。

关于第一个,检查 desktop/desktop issue 4325 可以帮助:

  • 在github桌面中打开存储库
  • 转到“文件”菜单并选择“存储库”>“在命令提示符下打开”
  • 运行命令 rm .git/refs/remotes/origin/master 删除断开的ref
  • 运行命令git fetch origin以获取ref的新副本
  • 运行命令 git branch -u origin/master 要让本地主分支跟踪源/主分支

当您(为了测试)在新的本地空文件夹中再次克隆repo时,还要检查问题是否仍然存在。