Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify integrity of a .git folder?

Tags:

I store my git repos in GlusterFS. Due to a split-brain condition, one of the git repos are in split-brain.

Now, is there a command that I can run on the storage boxes to see if any of the data bricks are valid git repos?

Meaning all the object files and other data for a git repos are intact?

like image 654
codefx Avatar asked Feb 27 '17 06:02

codefx


People also ask

How does git ensure file integrity?

There is no central repository. Git has integrity, meaning each file is checked (summed) to be sure there was no bit loss during any file manipulation by git. Each snapshot (also called commit) has a unique identifier.

Does git track the .git folder?

No, there isn't. But you can store in git a text files with the 2 or 3 commands you use to reconfigure each repository.

How do I access a .git folder?

git directory is a configuration file for git. Use the terminal to display the . git directory with the command ls -a . The ls command lists the current directory contents and by default will not show hidden files.


1 Answers

To verify the object you can use this simply command:

git fsck --full 

git-fsck
Verifies the connectivity and validity of the objects in the database

fsck - File System ChecK.
The name is taken from the Unix fsck command

https://git-scm.com/docs/git-fsck


If you want you can also verify the pack separately with but you basically dont need to do it.

git verify-pack [-v|--verbose] [-s|--stat-only] [--] .idx

Reads given idx file for packed Git archive created with the git pack-objects command and verifies idx file and the corresponding pack file.

like image 66
CodeWizard Avatar answered Dec 03 '22 11:12

CodeWizard