简体   繁体   English

git - 无法拉取或提交

[英]git -cant pull or commit

I have a problem committing, and pulling: In the commit IDE I see:我在提交和拉取时遇到问题:在提交 IDE 中,我看到:

warning not all local changes may be shown due to an error: unable to read tree 

and only part of my files commits is there, also I cant see diff with the last versions.并且只有部分文件提交存在,我也看不到与最新版本的差异。

when I try to pull/fetch:当我尝试拉/取时:

error: refs/remotes/origin/project-1 does not point to a valid object!
error: refs/remotes/origin/project-2 does not point to a valid object!
....

and so on等等

in the end, the error is最后,错误是

fatal: pack has 268 unresolved deltas

Is there any way for me to fix it without cloning again?我有什么办法可以在不克隆的情况下修复它?

ok, I fixed it by using好的,我通过使用修复了它

mv -v .git .git_old &&            # remove old git
git init &&                       # initialise new repo
git remote add origin "${url}" && # link to old repo
git fetch &&                      # get old history
git reset origin/master --mixed   # force update to old history

it's from this stack question How to fix corrupted git repository?它来自这个堆栈问题如何修复损坏的 git 存储库?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM