title: How do I deal with an error in my .gitmodules history?
body: <p>I get an error when I try to push a bit repo to a new server:</p>
  
  <pre><code>$ git push -f research master
  Enumerating objects: 13060, done.
  Counting objects: 100% (13060/13060), done.
  Delta compression using up to 4 threads
  Compressing objects: 100% (3397/3397), done.
  Writing objects: 100% (13060/13060), 5.59 MiB | 364.00 KiB/s, done.
  Total 13060 (delta 9516), reused 13060 (delta 9516)
  remote: Resolving deltas: 100% (9516/9516), done.
  remote: error: bad config line 14 in blob .gitmodules
  remote: error: object 4f098d01fb9671a7f5ff5f617ef89b289a8ea9bb: gitmodulesParse: could not parse gitmodules blob
  remote: fatal: fsck error in pack objects
  error: remote unpack failed: index-pack abnormal exit
  To gitlab.research.com:proj/repo.git
   ! [remote rejected] master -&gt; master (unpacker error)
  error: failed to push some refs to 'git@gitlab.research.com:proj/repo.git'
  $ 
  </code></pre>
  
  <p>Strangely, I get the same error when I run <code>git fsck</code> locally:</p>
  
  <pre><code>$ git fsck
  Checking object directories: 100% (256/256), done.
  warning in blob 4f098d01fb9671a7f5ff5f617ef89b289a8ea9bb: gitmodulesParse: could not parse gitmodules blob
  Checking objects: 100% (13060/13060), done.
  $ 
  </code></pre>
  
  <p>It turns out that "line 14" in the <code>.gitmodules</code> file is not in the current version of the file, which is only 11 lines long. The problem results because there was a version of <code>.gitmodules</code> that was committed which had a conflict.</p>
  
  <p>Can I just delete the blob and push it to the new repo, or is there a deep problem that I cannot easily fix?</p>
  
  <p><strong>EDIT - NEW INFORMATION!</strong></p>
  
  <p>Given @torek's excellent posting below, combined with the script in <a href="https://stackoverflow.com/questions/223678/which-commit-has-this-blob">Which commit has this blob?</a> (the first script worked, but the second one did not), I was able to find the problematic commit:</p>
  
  <pre><code>$ ~/.bin/git-find-object 4f098d01fb9671a7f5ff5f617ef89b289a8ea9bb
  06407fd merged changes from master and stats
  </code></pre>
  
  <p>My git repo only has one branch visible:</p>
  
  <pre><code>$ git branch -v
  * master e8ff018 minor
  </code></pre>
  
  <p>I can check out the problematic commit:</p>
  
  <pre><code>$ git checkout 06407fd
  Checking out files: 100% (321/321), done.
  fatal: bad config line 14 in file /home/xv32/gits/repo/.gitmodules
  
  $
  </code></pre>
  
  <p>I edited the <code>.gitmodules</code> file directly, and removed the offending lines:</p>
  
  <pre><code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD
          branch = ee
  =======
  &gt;&gt;&gt;&gt;&gt;&gt;&gt; master
  </code></pre>
  
  <p>I did an <code>git add .gitmodules</code></p>
  
  <p>I did a:</p>
  
  <pre><code>$ git commit --amend -m 'fixed conflict in .gitmodules'
  </code></pre>
  
  <p>OMG it changed a lot of stuff.</p>
  
  <p>I then did a git status:</p>
  
  <pre><code>$ git status
  On branch master
  Your branch and 'origin/master' have diverged,
  and have 1 and 1 different commits each, respectively.
    (use "git pull" to merge the remote branch into yours)
  
  Changes not staged for commit:
    (use "git add &lt;file&gt;..." to update what will be committed)
    (use "git checkout -- &lt;file&gt;..." to discard changes in working directory)
  
          modified:   submodule1 (new commits)
          modified:   submodule2 (new commits)
          modified:   submodule3(new commits)
  
  no changes added to commit (use "git add" and/or "git commit -a")
  
  $
  </code></pre>
  
  <p>git fsck no longer reports problems:</p>
  
  <pre><code>$ git fsck
  Checking object directories: 100% (256/256), done.
  Checking objects: 100% (15206/15206), done.
  </code></pre>
  
  <p>But I am still unable to push to the remote repo:</p>
  
  <pre><code>$ git push -f research master
  Counting objects: 13245, done.
  Delta compression using up to 8 threads.
  Compressing objects: 100% (3395/3395), done.
  Writing objects: 100% (13245/13245), 5.68 MiB | 2.81 MiB/s, done.
  Total 13245 (delta 9746), reused 13180 (delta 9702)
  remote: error: bad config line 14 in blob .gitmodules
  remote: error: object 4f098d01fb9671a7f5ff5f617ef89b289a8ea9bb: gitmodulesParse: could not parse gitmodules blob
  remote: fatal: fsck error in packed object
  error: remote unpack failed: index-pack abnormal exit
  To https://gitlab.research.com/repo/repo.git
   ! [remote rejected] master -&gt; master (unpacker error)
  error: failed to push some refs to 'https://gitlab.research.com/censyn-sensitive/das_decennial.git'
  
  $
  </code></pre>
  
  <p>Also, when I do the <code>git --amend</code>, a whole bunch of important things disappear, beyond the bad lines in the object.</p>
  
  <p>Honestly, I do not understand why I am even getting an error, since the error is not at the top of the tree. </p>