Gitlab存储库错误找不到包条目

muk1a3rh  于 2023-05-05  发布在  Git
关注(0)|答案(2)|浏览(171)

Gitlab存储库已损坏。前端出现500内部服务器错误。

Started GET "/" for 127.0.0.1 at 2016-04-11 16:22:02 +0530
Processing by DashboardController#show as HTML
Read fragment views/projects/44-20160408141103000000000/dashboard/show/cc53ca8d7b83612d3f40df2a690c7950 (0.1ms)
Completed 500 Internal Server Error in 27ms

ActionView::Template::Error (Object not found - failed to find pack entry (509db335d2df02b878c18e1a6fe84393da6978c1)):
    2:   = link_to project_path(project), class: dom_class(project) do
    3:     - if avatar
    4:       .dash-project-avatar
    5:         = project_icon(project, alt: '', class: 'avatar project-avatar s40')
    6:     .dash-project-access-icon
    7:       = visibility_level_icon(project.visibility_level)
    8:     %span.str-truncated
  app/models/repository.rb:8:in `new'
o2g1uqev

o2g1uqev1#

执行以下步骤

1. # cd gitlab/repositories/<namespace>/<reponame>.git 

2. # git fsck
If any error like below
error: object file objects/11/fbf0dfb1a54283e84044b5e99230efbafd77d8 is empty
error: object file objects/11/fbf0dfb1a54283e84044b5e99230efbafd77d8 is empty
fatal: loose object 11fbf0dfb1a54283e84044b5e99230efbafd77d8 (stored in objects/11/fbf0dfb1a54283e84044b5e99230efbafd77d8) is corrupt

3.  # find . –size 0 –delete  
This will delete all files which has 0 byte size and corrupt

4.  # git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (4970/4970), done.
error: HEAD: not a commit
error: refs/heads/master: not a commit
dangling commit de516dd3d99d13147b6e2f946fe5b8c0660e4eed

5.   Try to push code from local without add and commit 
# git push origin <branch>
If got below error
remote: error: Could not read 5329f756010fad47026f112dc7126bdaa2f9ad7f
remote: fatal: Failed to traverse parents of commit  8eecd866caa916a3b2e8550153f0bb5a54a28919
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

6.  Go to cd gitlab/repositories/<namespace>/<reponame>.git
# rm –fr ref/head/<branchname>
# git fsck
notice: HEAD points to an unborn branch (master)
Checking object directories: 100% (256/256), done.
notice: No default references
dangling commit eb84ebc9010ea3d3d5646b4eab1bacd358178fbd

7.  Try to push code from local without add and commit 
# git push origin <branch>

Done your code updated successfully !!!
bkhjykvo

bkhjykvo2#

如果你在2023年应用它,随着Git 2.41(2023年第二季度),“git fsck”(man)学会了验证磁盘包上的反向索引文件。
它可以检测更多的包条目。
参见commit 5a6072fcommit 5f658d1commit d975fe1commit 0d30fee(2023年4月17日)by Derrick Stolee ( derrickstolee )
参见commit 3c63503(2023年4月17日),作者Junio C Hamano ( gitster )
(由Junio C Hamano -- gitster --合并于commit a02675a,2023年4月27日)

fsck:为rev-index检查创建脚手架

签字人:德里克·斯托利
'fsck'内置检查了许多Git的磁盘数据结构,但目前不验证包rev-index文件(一个.rev文件与一个.pack.idx文件配对)。
在执行更复杂的检查过程之前,在builtin/fsck.c中创建脚手架,以具有新的错误类型,并在API方法verify_pack_revindex()返回错误时添加该错误类型。
该方法目前不做任何事情,但我们将在以后的更改中向其添加检查。
现在,检查'git fsck'(man)在正常情况下成功而没有任何错误。
将来的检查将与适当损坏.rev文件的测试配对。

相关问题