如何修复缺少对象的git存储库? [英] How can I repair a git repository with a missing object?

查看:66
本文介绍了如何修复缺少对象的git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发存储库有时丢失了一个对象.

My development repository at some point lost an object.

$ git fsck
fatal: failed to read object 2dddc84156fa30e4614a7ea5a1895885011b8db8: Invalid argument
$ git cat-file -t 2dddc84156fa30e4614a7ea5a1895885011b8db8
error: unable to find 2dddc84156fa30e4614a7ea5a1895885011b8db8
fatal: git cat-file 2dddc84156fa30e4614a7ea5a1895885011b8db8: bad file

一个新克隆的存储库具有该对象.

A freshly cloned repository has that object.

$ git cat-file -t 2dddc84156fa30e4614a7ea5a1895885011b8db8
tree

我想保留我的开发存储库,它具有未按下的分支和存储.

I would like to keep my development repository, it has unpushed branches and stashes.

如何将该对象修补到损坏的存储库中?

How can I patch that object into my broken repository?

推荐答案

您可以尝试的是从新克隆的存储库中获取文件.git/objects/2d/ddc84156fa30e4614a7ea5a1895885011b8db8并将其复制到您的开发仓库中...

What you can try, is to get the file .git/objects/2d/ddc84156fa30e4614a7ea5a1895885011b8db8 from the freshly cloned repository and copy it to your development repo ...

这篇关于如何修复缺少对象的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆