1GIT-FSCK(1)                       Git Manual                       GIT-FSCK(1)
2
3
4

NAME

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

SYNOPSIS

10       git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
11                [--[no-]full] [--strict] [--verbose] [--lost-found]
12                [--[no-]dangling] [--[no-]progress] [--connectivity-only]
13                [--[no-]name-objects] [<object>...]
14

DESCRIPTION

16       Verifies the connectivity and validity of the objects in the database.
17

OPTIONS

19       <object>
20           An object to treat as the head of an unreachability trace.
21
22           If no objects are given, git fsck defaults to using the index file,
23           all SHA-1 references in refs namespace, and all reflogs (unless
24           --no-reflogs is given) as heads.
25
26       --unreachable
27           Print out objects that exist but that aren’t reachable from any of
28           the reference nodes.
29
30       --[no-]dangling
31           Print objects that exist but that are never directly used
32           (default).  --no-dangling can be used to omit this information from
33           the output.
34
35       --root
36           Report root nodes.
37
38       --tags
39           Report tags.
40
41       --cache
42           Consider any object recorded in the index also as a head node for
43           an unreachability trace.
44
45       --no-reflogs
46           Do not consider commits that are referenced only by an entry in a
47           reflog to be reachable. This option is meant only to search for
48           commits that used to be in a ref, but now aren’t, but are still in
49           that corresponding reflog.
50
51       --full
52           Check not just objects in GIT_OBJECT_DIRECTORY ($GIT_DIR/objects),
53           but also the ones found in alternate object pools listed in
54           GIT_ALTERNATE_OBJECT_DIRECTORIES or
55           $GIT_DIR/objects/info/alternates, and in packed Git archives found
56           in $GIT_DIR/objects/pack and corresponding pack subdirectories in
57           alternate object pools. This is now default; you can turn it off
58           with --no-full.
59
60       --connectivity-only
61           Check only the connectivity of reachable objects, making sure that
62           any objects referenced by a reachable tag, commit, or tree is
63           present. This speeds up the operation by avoiding reading blobs
64           entirely (though it does still check that referenced blobs exist).
65           This will detect corruption in commits and trees, but not do any
66           semantic checks (e.g., for format errors). Corruption in blob
67           objects will not be detected at all.
68
69           Unreachable tags, commits, and trees will also be accessed to find
70           the tips of dangling segments of history. Use --no-dangling if you
71           don’t care about this output and want to speed it up further.
72
73       --strict
74           Enable more strict checking, namely to catch a file mode recorded
75           with g+w bit set, which was created by older versions of Git.
76           Existing repositories, including the Linux kernel, Git itself, and
77           sparse repository have old objects that triggers this check, but it
78           is recommended to check new projects with this flag.
79
80       --verbose
81           Be chatty.
82
83       --lost-found
84           Write dangling objects into .git/lost-found/commit/ or
85           .git/lost-found/other/, depending on type. If the object is a blob,
86           the contents are written into the file, rather than its object
87           name.
88
89       --name-objects
90           When displaying names of reachable objects, in addition to the
91           SHA-1 also display a name that describes how they are reachable,
92           compatible with git-rev-parse(1), e.g.
93           HEAD@{1234567890}~25^2:src/.
94
95       --[no-]progress
96           Progress status is reported on the standard error stream by default
97           when it is attached to a terminal, unless --no-progress or
98           --verbose is specified. --progress forces progress status even if
99           the standard error stream is not directed to a terminal.
100

CONFIGURATION

102       Everything below this line in this section is selectively included from
103       the git-config(1) documentation. The content is the same as what’s
104       found there:
105
106       fsck.<msg-id>
107           During fsck git may find issues with legacy data which wouldn’t be
108           generated by current versions of git, and which wouldn’t be sent
109           over the wire if transfer.fsckObjects was set. This feature is
110           intended to support working with legacy repositories containing
111           such data.
112
113           Setting fsck.<msg-id> will be picked up by git-fsck(1), but to
114           accept pushes of such data set receive.fsck.<msg-id> instead, or to
115           clone or fetch it set fetch.fsck.<msg-id>.
116
117           The rest of the documentation discusses fsck.*  for brevity, but
118           the same applies for the corresponding receive.fsck.*  and
119           fetch.<msg-id>.*. variables.
120
121           Unlike variables like color.ui and core.editor the
122           receive.fsck.<msg-id> and fetch.fsck.<msg-id> variables will not
123           fall back on the fsck.<msg-id> configuration if they aren’t set. To
124           uniformly configure the same fsck settings in different
125           circumstances all three of them they must all set to the same
126           values.
127
128           When fsck.<msg-id> is set, errors can be switched to warnings and
129           vice versa by configuring the fsck.<msg-id> setting where the
130           <msg-id> is the fsck message ID and the value is one of error, warn
131           or ignore. For convenience, fsck prefixes the error/warning with
132           the message ID, e.g. "missingEmail: invalid author/committer line -
133           missing email" means that setting fsck.missingEmail = ignore will
134           hide that issue.
135
136           In general, it is better to enumerate existing objects with
137           problems with fsck.skipList, instead of listing the kind of
138           breakages these problematic objects share to be ignored, as doing
139           the latter will allow new instances of the same breakages go
140           unnoticed.
141
142           Setting an unknown fsck.<msg-id> value will cause fsck to die, but
143           doing the same for receive.fsck.<msg-id> and fetch.fsck.<msg-id>
144           will only cause git to warn.
145
146           See Fsck Messages section of git-fsck(1) for supported values of
147           <msg-id>.
148
149       fsck.skipList
150           The path to a list of object names (i.e. one unabbreviated SHA-1
151           per line) that are known to be broken in a non-fatal way and should
152           be ignored. On versions of Git 2.20 and later comments (#), empty
153           lines, and any leading and trailing whitespace is ignored.
154           Everything but a SHA-1 per line will error out on older versions.
155
156           This feature is useful when an established project should be
157           accepted despite early commits containing errors that can be safely
158           ignored such as invalid committer email addresses. Note: corrupt
159           objects cannot be skipped with this setting.
160
161           Like fsck.<msg-id> this variable has corresponding
162           receive.fsck.skipList and fetch.fsck.skipList variants.
163
164           Unlike variables like color.ui and core.editor the
165           receive.fsck.skipList and fetch.fsck.skipList variables will not
166           fall back on the fsck.skipList configuration if they aren’t set. To
167           uniformly configure the same fsck settings in different
168           circumstances all three of them they must all set to the same
169           values.
170
171           Older versions of Git (before 2.20) documented that the object
172           names list should be sorted. This was never a requirement, the
173           object names could appear in any order, but when reading the list
174           we tracked whether the list was sorted for the purposes of an
175           internal binary search implementation, which could save itself some
176           work with an already sorted list. Unless you had a humongous list
177           there was no reason to go out of your way to pre-sort the list.
178           After Git version 2.20 a hash implementation is used instead, so
179           there’s now no reason to pre-sort the list.
180

DISCUSSION

182       git-fsck tests SHA-1 and general object sanity, and it does full
183       tracking of the resulting reachability and everything else. It prints
184       out any corruption it finds (missing or bad objects), and if you use
185       the --unreachable flag it will also print out objects that exist but
186       that aren’t reachable from any of the specified head nodes (or the
187       default set, as mentioned above).
188
189       Any corrupt objects you will have to find in backups or other archives
190       (i.e., you can just remove them and do an rsync with some other site in
191       the hopes that somebody else has the object you have corrupted).
192
193       If core.commitGraph is true, the commit-graph file will also be
194       inspected using git commit-graph verify. See git-commit-graph(1).
195

EXTRACTED DIAGNOSTICS

197       unreachable <type> <object>
198           The <type> object <object>, isn’t actually referred to directly or
199           indirectly in any of the trees or commits seen. This can mean that
200           there’s another root node that you’re not specifying or that the
201           tree is corrupt. If you haven’t missed a root node then you might
202           as well delete unreachable nodes since they can’t be used.
203
204       missing <type> <object>
205           The <type> object <object>, is referred to but isn’t present in the
206           database.
207
208       dangling <type> <object>
209           The <type> object <object>, is present in the database but never
210           directly used. A dangling commit could be a root node.
211
212       hash mismatch <object>
213           The database has an object whose hash doesn’t match the object
214           database value. This indicates a serious data integrity problem.
215

FSCK MESSAGES

217       The following lists the types of errors git fsck detects and what each
218       error means, with their default severity. The severity of the error,
219       other than those that are marked as "(FATAL)", can be tweaked by
220       setting the corresponding fsck.<msg-id> configuration variable.
221
222       badDate
223           (ERROR) Invalid date format in an author/committer line.
224
225       badDateOverflow
226           (ERROR) Invalid date value in an author/committer line.
227
228       badEmail
229           (ERROR) Invalid email format in an author/committer line.
230
231       badFilemode
232           (INFO) A tree contains a bad filemode entry.
233
234       badName
235           (ERROR) An author/committer name is empty.
236
237       badObjectSha1
238           (ERROR) An object has a bad sha1.
239
240       badParentSha1
241           (ERROR) A commit object has a bad parent sha1.
242
243       badTagName
244           (INFO) A tag has an invalid format.
245
246       badTimezone
247           (ERROR) Found an invalid time zone in an author/committer line.
248
249       badTree
250           (ERROR) A tree cannot be parsed.
251
252       badTreeSha1
253           (ERROR) A tree has an invalid format.
254
255       badType
256           (ERROR) Found an invalid object type.
257
258       duplicateEntries
259           (ERROR) A tree contains duplicate file entries.
260
261       emptyName
262           (WARN) A path contains an empty name.
263
264       extraHeaderEntry
265           (IGNORE) Extra headers found after tagger.
266
267       fullPathname
268           (WARN) A path contains the full path starting with "/".
269
270       gitattributesSymlink
271           (INFO) .gitattributes is a symlink.
272
273       gitignoreSymlink
274           (INFO) .gitignore is a symlink.
275
276       gitmodulesBlob
277           (ERROR) A non-blob found at .gitmodules.
278
279       gitmodulesLarge
280           (ERROR) The .gitmodules file is too large to parse.
281
282       gitmodulesMissing
283           (ERROR) Unable to read .gitmodules blob.
284
285       gitmodulesName
286           (ERROR) A submodule name is invalid.
287
288       gitmodulesParse
289           (INFO) Could not parse .gitmodules blob.
290
291       gitmodulesLarge; (ERROR) .gitmodules blob is too large to parse.
292
293       gitmodulesPath
294           (ERROR) .gitmodules path is invalid.
295
296       gitmodulesSymlink
297           (ERROR) .gitmodules is a symlink.
298
299       gitmodulesUpdate
300           (ERROR) Found an invalid submodule update setting.
301
302       gitmodulesUrl
303           (ERROR) Found an invalid submodule url.
304
305       hasDot
306           (WARN) A tree contains an entry named ..
307
308       hasDotdot
309           (WARN) A tree contains an entry named ...
310
311       hasDotgit
312           (WARN) A tree contains an entry named .git.
313
314       mailmapSymlink
315           (INFO) .mailmap is a symlink.
316
317       missingAuthor
318           (ERROR) Author is missing.
319
320       missingCommitter
321           (ERROR) Committer is missing.
322
323       missingEmail
324           (ERROR) Email is missing in an author/committer line.
325
326       missingNameBeforeEmail
327           (ERROR) Missing name before an email in an author/committer line.
328
329       missingObject
330           (ERROR) Missing object line in tag object.
331
332       missingSpaceBeforeDate
333           (ERROR) Missing space before date in an author/committer line.
334
335       missingSpaceBeforeEmail
336           (ERROR) Missing space before the email in author/committer line.
337
338       missingTag
339           (ERROR) Unexpected end after type line in a tag object.
340
341       missingTagEntry
342           (ERROR) Missing tag line in a tag object.
343
344       missingTaggerEntry
345           (INFO) Missing tagger line in a tag object.
346
347       missingTree
348           (ERROR) Missing tree line in a commit object.
349
350       missingType
351           (ERROR) Invalid type value on the type line in a tag object.
352
353       missingTypeEntry
354           (ERROR) Missing type line in a tag object.
355
356       multipleAuthors
357           (ERROR) Multiple author lines found in a commit.
358
359       nulInCommit
360           (WARN) Found a NUL byte in the commit object body.
361
362       nulInHeader
363           (FATAL) NUL byte exists in the object header.
364
365       nullSha1
366           (WARN) Tree contains entries pointing to a null sha1.
367
368       treeNotSorted
369           (ERROR) A tree is not properly sorted.
370
371       unknownType
372           (ERROR) Found an unknown object type.
373
374       unterminatedHeader
375           (FATAL) Missing end-of-line in the object header.
376
377       zeroPaddedDate
378           (ERROR) Found a zero padded date in an author/commiter line.
379
380       zeroPaddedFilemode
381           (WARN) Found a zero padded filemode in a tree.
382

ENVIRONMENT VARIABLES

384       GIT_OBJECT_DIRECTORY
385           used to specify the object database root (usually $GIT_DIR/objects)
386
387       GIT_INDEX_FILE
388           used to specify the index file of the index
389
390       GIT_ALTERNATE_OBJECT_DIRECTORIES
391           used to specify additional object database roots (usually unset)
392

GIT

394       Part of the git(1) suite
395
396
397
398Git 2.39.1                        2023-01-13                       GIT-FSCK(1)
Impressum