修复丢失的提交 [英] Fix missing commit

查看:127
本文介绍了修复丢失的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手。我们使用Bonobo Git Server作为后端,使用TortoiseGit作为客户端。当我做一个pull时,我在TortoiseGit中得到以下内容 -

  POST git-upload-pack(328字节)
致命错误:协议错误:坏行长度字符:<!DO
致命错误:写入错误:无效参数


git未完全退出(退出代码1)

倭黑猩猩的错误日志说 -

  GitSharp.Core.Exceptions.MissingObjectException:缺少提交提交903228ffc07ea920fd944c6fcdd5d8d5ef852ff1 0 ------ 

我在 .git \objects 文件夹下找到了一个开发人员机器上缺少的 903228ffc07ea920fd944c6fcdd5d8d5ef852ff1 文件。我怎么把这个放在服务器上并让repo再次工作?请帮助。



我在另一个线程上阅读,我需要 repack 它并将其推送到服务器?我怎么做?我是Git的新手。我使用Windows。

解决方案

首先备份已损坏的存储库,以防万一。 b

然后,只需将良好的文件复制到服务器上的 git / objects / 90/3228 ...



请参阅

如果有很多丢失的对象,您确实可以将它们发送到一个包中:


  1. 在服务器上,查找缺少对象的SHA-1总和

      git fsck | grep缺少| grep -o'[0-9a-f] \ {40 \}'>缺少


  2. 在开发者的机器上,打包丢失的对象

      git pack-objects --stdout<缺失> objects.pack 


  3. 在服务器上,解包pack文件

      git unpack-objects< objects.pack 



I'm new to Git. We're using Bonobo Git Server as the back-end and TortoiseGit for the client. When I do a pull I get the following in TortoiseGit -

POST git-upload-pack (328 bytes)
fatal: protocol error: bad line length character: <!DO
fatal: write error: Invalid argument


git did not exit cleanly (exit code 1)

Bonobo's error log says -

   GitSharp.Core.Exceptions.MissingObjectException: Missing commit commit 903228ffc07ea920fd944c6fcdd5d8d5ef852ff1 0 ------

I've found the missing 903228ffc07ea920fd944c6fcdd5d8d5ef852ff1 file on one of the developer's machines under .git\objects folder. How do I put this on the server and get the repo working again? Please help.

I read on a different thread that I need to repack it and push it to the server? How do I do that? I'm a newbie at Git. I'm using Windows.

解决方案

First backup the corrupted repository in case you make things worse.

Then just copy the good file to git/objects/90/3228... on the server.

See Recovering from repository corruption for more information.

If there are lots of missing objects you can indeed send them in a pack:

  1. On the server, find the SHA-1 sums of the missing objects

    git fsck | grep missing | grep -o '[0-9a-f]\{40\}' > missing
    

  2. On the developer's machine, pack the missing objects

    git pack-objects --stdout < missing > objects.pack
    

  3. On the server, unpack the pack file

    git unpack-objects < objects.pack
    

这篇关于修复丢失的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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