问题
I was happily using Git - made some commits a couple of nights ago, which are reflected in the remote repo. Last night I opened up Smartgit Hg and it tells me there are missing trees. I ran git fsck --full
and got the rather large output below.
I'm a Git amateur. I use a GUI to do what I need to do. I've tried reading through this (https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F) but it isn't making an awful lot of sense and following it blindly doesn't seem to be working.
I did a git ls-tree c957fc03bb53181547142045917211fbc380a8df
and it shows me a list of files. I had 3 with a 100644
at the beginning, so I moved in to that directory, ran git hash-object -w filename
and it output the same hash as the ls-tree
showed me.
The wiki page says now I'm all done. Except git fsck --full
still shows the same message for that tree. I get the feeling that I'm probably running these commands on the wrong thing.
I've tried reading other git posts on here, but they don't make sense to me. I won't lie.
git fsck --full Checking object directories: 100% (256/256), done. Checking objects: 100% (1149/1149), done. broken link from tree c957fc03bb53181547142045917211fbc380a8df to tree e7822f570245310f4b475e043f5fb02fa45c0d9e broken link from tree 8005ba4728321473684e670feb9c1ada8783c007 to tree 4df5de19988a1fd7088da6e8214404cda2069852 broken link from tree 3b1b915c6f306ae4f80a2b61767c4267d48df53d to tree 4dc2258f8d36dbeea64b859ab5dff0fadc5bd591 broken link from tree c850459b3bd5899bd0a9eca40d69e49582f44a19 to tree 912613a23bcb22f211ce0d8ab4fe2a8fddde78b6 broken link from commit 8775851e59bd5072ab98a739cfc00b231be54eab to tree 90e5f62642dde43c110b9882c564349074097955 broken link from tree 331b16c460e6f9dd3bae9b0206857fc2c57bacb8 to tree fdead5b5ff4ae53b54104ab5b7fa2369f0adb4f7 broken link from tree 3ca3d56fd7eabe9efb0d4212615cf85ced8f663f to tree 099070c9c54a16ca6b78c384a43c2e45d56eed71 broken link from tree ffe425a5a568e5e515fa5745e8dd0a3f9148ac6a to tree 91ec315f9730d3541bba2603f09d69b2b6d5ead0 broken link from tree e38aa29f31a314bf71c40d800ea9d4b9422a09c3 to tree b9760875bb7b8be0799435625fd686c985860de2 broken link from tree 920755bbb97bcf526bfbd492451182bec66e6d39 to tree d4dcb141f4ea62228e85f6b35c5b4d2f22a8720e broken link from tree 298bbba4562267349db2539e43cd2f12cd4317dd to tree b8234d1f9efcc9691f2b35b8e4237dfa08bc140a broken link from commit f106420cddf314c6efa2e015e348006b82cd6348 to tree a5b976cb4f82b339f22c74811f47ad31d353764b broken link from commit 5968e9e1479fdbba079ab64a6171f98b0f869b41 to tree 64171c569ea7f74f59dc8f3dcc957220aa09f343 broken link from commit c54b5f446988645caf935382ea7bbc7ec57092f2 to tree fda728fd6e61790133f15e073335e2e6c43dc31b broken link from commit 37a6d43e9645873ab2315e641ef8bf55afc08012 to tree 90c19ab5f9cb64e40cfcad2e30e1cf98ad586502 broken link from tree 32009a6e84fd8639b411433d13bb707ed25a8992 to tree 691f8fac71c39b2182acf51f56ac39c4bc4759d5 broken link from tree 41db7d6238919ea58c2c64d9f333c63650e0e95a to tree 649a4fc0f5a9d06c67223a36116c7c8aeaa2c6b9 broken link from tree 84f823c8d4032a3fe09ba4d962603fcb975dbf98 to tree 7bb4a11dd10def2f1f4f9bae4eea02848fb833cb broken link from commit 1b85354dd48be428b4d3937da24a9951efa9f451 to tree 3d437dcff812a0e123d2e4b741dba47ad08a6b9e broken link from commit 2cbfbe123e1a61584c519f190015622ae5b5c8c0 to tree 0013af31f091e2d22b7ff7e63badf305597e63b4 broken link from tree fef036d59eb8944bb494a0eff85325c108fccf34 to tree 896deb89905c80893512a61d9f8e9fc3760f3a53 broken link from tree f26d568cf61282aa1f04e7828bddf8f9d7cf8ecb to tree 3d7994b9dad00c47c64b99e30693c0215b0aa5eb broken link from tree bc7d7d62d92c8989d9e398c8cbf036f1e205f855 to tree ea29c58710d7d3aa7cce589de9b46503d0e9565e broken link from tree 447585f3684b9915ba0ce99f41359da197ee8f54 to tree 0992afc3aa3aa332fe3dc927a5e334f69638a898 broken link from commit 5e622e95cb5336521cbbdb7c03b860bb74eb9f8c to tree 7f91438587057ac610e44a5cf3318440e004a9bc broken link from tree 32f13f592d0a56d467234b838930039c0438e019 to tree 9d3328f820a9308bab950ee9e513a200acd6d3f4 missing tree 099070c9c54a16ca6b78c384a43c2e45d56eed71 dangling tree 5a0069463363b395881958eb8d9aac7ba1b9ddd8 dangling tree 932053ef04d4f540d250d5e74332d141b4037009 dangling tree c7a04a22febdeb307f38019aff2e4f7645a7ea9f dangling tree cf10f1a8c2bb57520c6e0ad256e9fb344961c13a dangling tree 2c51ad373aef4844fc9e6babd878dfae5f5592b3 missing tree 7f91438587057ac610e44a5cf3318440e004a9bc missing tree 90c19ab5f9cb64e40cfcad2e30e1cf98ad586502 missing tree 0992afc3aa3aa332fe3dc927a5e334f69638a898 dangling blob 24226e3db997d21dc10aa70a9a8aa279aa55fb8a missing tree 4dc2258f8d36dbeea64b859ab5dff0fadc5bd591 dangling tree 9c322d15436be34a99fcea442ad97ae40715ac61 dangling tree b4d2505972386aba42282232843d4e1b73148be4 missing tree e7822f570245310f4b475e043f5fb02fa45c0d9e missing tree 0013af31f091e2d22b7ff7e63badf305597e63b4 missing blob 35e3ddbc07214e74d8ad516736ee0e90b0a285c8 missing tree 3d437dcff812a0e123d2e4b741dba47ad08a6b9e dangling tree 6d637bdae8eff5490df307fce3fd8a1bb2e5ce14 dangling tree 79934929fc8423ec1c277ab21d14b7434cde7544 missing tree 9d3328f820a9308bab950ee9e513a200acd6d3f4 missing tree b8234d1f9efcc9691f2b35b8e4237dfa08bc140a dangling tree d1333fd1a2c9fed8bc3cc6f58ae00bf7fbe7c482 missing blob 20149c8fb22e309a26f477f0e500e122f6e99e66 dangling tree 4054641b41208cc98387806a877855db15a109f9 missing tree 7bb4a11dd10def2f1f4f9bae4eea02848fb833cb dangling tree f4948b5302a1fe79ea09c5959e0f3902d022a2b3 missing tree 4df5de19988a1fd7088da6e8214404cda2069852 missing tree 90e5f62642dde43c110b9882c564349074097955 dangling tree 7966c4a2fc16a5559b569f5e200c0f01f0b186db missing tree 912613a23bcb22f211ce0d8ab4fe2a8fddde78b6 missing commit b976d2df1880cb6c90db5bdf856440904cd22574 missing tree b9760875bb7b8be0799435625fd686c985860de2 missing commit 35e7e9f65cf5950ae2855afaf764672dd48a8b9b missing tree 64171c569ea7f74f59dc8f3dcc957220aa09f343 missing tree fda728fd6e61790133f15e073335e2e6c43dc31b dangling tree 29088a01bfe6bde49cf1176b7ed1171dd8f8e334 missing commit e27876491d426b8d9f3932eb2ee494145f8776b5 dangling tree e3c8535db10a99db65fbd5c2e58e2c3b59159d24 missing tree 3d7994b9dad00c47c64b99e30693c0215b0aa5eb dangling tree 6129fef595c71128c0dc24ebd4248ef231cfe90d missing tree a5b976cb4f82b339f22c74811f47ad31d353764b missing tree ea29c58710d7d3aa7cce589de9b46503d0e9565e missing tree 649a4fc0f5a9d06c67223a36116c7c8aeaa2c6b9 missing commit 8f2ad8d3aaccfcfad8cd7c30ea938008378591fd missing blob ea1ae4f5cd2a6ec1e9982108cdbce7de5858d0d9 dangling tree f69a44eac9426e3fcfb4eb1545c966beb72b37b0 missing tree fdead5b5ff4ae53b54104ab5b7fa2369f0adb4f7 missing commit a69b6f1a1b224b2ba846590d6ddd65ca0079a1bb missing blob 453c02a0bbce4748a3e3d3da4c29498cbf4b01d0 missing tree 91ec315f9730d3541bba2603f09d69b2b6d5ead0 missing tree d4dcb141f4ea62228e85f6b35c5b4d2f22a8720e missing tree 896deb89905c80893512a61d9f8e9fc3760f3a53 dangling tree deeec6312c058722ffcf1b5cf14d997c14890eb1 dangling blob 0b7fc81faf339d77c2146f406a9f90c4431da4e2 missing tree 691f8fac71c39b2182acf51f56ac39c4bc4759d5 missing blob 7fef3c0e58d6c2825703576b3ecb148040e2b0cf dangling tree 95cf9c35987a0b715d4f736d2cf9dacf82c958ae dangling tree ce4feefca69bd3fbc82205c4c3f1c116f73b623c
回答1:
Try cloning the remote repository into a new folder.
Does it also have these errors? If not, simply use this clone and delete the corrupted one.
Any modified files that have not yet been committed can simple be copied to the new folder. Important: Don't copy the .git
folder.
回答2:
For me, a simple git gc
did the job... This gave me a couple of rm: cannot unlink ... Permission denied messages. But in the end, it seemed to have worked for my case.
Bug probably depends on how exactly the repo is corrupted.
来源:https://stackoverflow.com/questions/16955523/git-broken-links-missing-dangling-trees