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

DISCUSSION

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

EXTRACTED DIAGNOSTICS

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

FSCK MESSAGES

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

ENVIRONMENT VARIABLES

400       GIT_OBJECT_DIRECTORY
401           used to specify the object database root (usually $GIT_DIR/objects)
402
403       GIT_INDEX_FILE
404           used to specify the index file of the index
405
406       GIT_ALTERNATE_OBJECT_DIRECTORIES
407           used to specify additional object database roots (usually unset)
408

GIT

410       Part of the git(1) suite
411
412
413
414Git 2.43.0                        11/20/2023                       GIT-FSCK(1)
Impressum