1.问题起因
办公网机房意外断掉,导致gitlab库文件损坏。开发打开gitlab显示500
2.查看日志
命令查看:gitlab-ctl tail
或者手动查看:/var/log/gitlab/gitlab-rails/production.log日志文件
gitlab Rugged::OdbError (Failed to inflate loose object.)
提示库文件损坏
3.处理方法
参考链接:
执行以下步骤后,库恢复正常
. # cd gitlab/repositories/<namespace>/<reponame>.git . # git fsck
If any error like below
error: object file objects//fbf0dfb1a54283e84044b5e99230efbafd77d8 is empty
error: object file objects//fbf0dfb1a54283e84044b5e99230efbafd77d8 is empty
fatal: loose object 11fbf0dfb1a54283e84044b5e99230efbafd77d8 (stored in objects//fbf0dfb1a54283e84044b5e99230efbafd77d8) is corrupt . # find . –size –delete
This will delete all files which has byte size and corrupt . # git fsck
Checking object directories: % (/), done.
Checking objects: % (/), done.
error: HEAD: not a commit
error: refs/heads/master: not a commit
dangling commit de516dd3d99d13147b6e2f946fe5b8c0660e4eed . 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 . 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: % (/), done.
notice: No default references
dangling commit eb84ebc9010ea3d3d5646b4eab1bacd358178fbd . Try to push code from local without add and commit
# git push origin <branch> Done your code updated successfully !!!