Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check status of bare repo in git

I have a bare repo cloned and need to check if the repo is broken. I tried running git status, but it says:

fatal: this operation must be run in a work tree. 

I have also tried running git gc and it returns non-zero if the repo is broken. But this takes hell of a time as repo size is big.

Any alternate approach in doing this?

Update: I have tried git fsck, and this also takes more or less same time as git gc. The repo size is almost ~16 gb :(

like image 763
Muni Avatar asked Sep 11 '25 15:09

Muni


1 Answers

With a recent enough Git (2.30+), you can also try a git maintenance command.

Specifically: git maintenance start

If it starts successfully, the repository is not broken.

like image 142
VonC Avatar answered Sep 13 '25 05:09

VonC