title: gitignore not untracking my database
body: <p>I set up a simple nodejs express server with a mongodb database.
  Unfortunately I forgot to add a proper gitignore before trying to sync my code to github.</p>
  
  <p>The push command fails, because the journals of my database are too huge.</p>
  
  <p>Now I've added a .gitignore file that contains just the line </p>
  
  <pre><code>data
  </code></pre>
  
  <p>since that's where the database is stored.</p>
  
  <p>I ran this code in the shell (Ubuntu 14.10):</p>
  
  <pre><code>git rm -r --cached
  git add .
  git commit -m "untracked database"
  git push --set-upstream origin master
  </code></pre>
  
  <p>Surprisingly the push still fails:</p>
  
  <blockquote>
    <p>file data/journal/j._0 is 1024mb; this exceeds githubs file size limit of 100mb</p>
  </blockquote>
  
  <p>So the gitignore is not working ?</p>
  
  <pre><code>git rm -r --cached
  git add .gitignore
  git add *
  git commit -m "untracked database 2"
  git push --set-upstream origin master
  </code></pre>
  
  <p>Same error</p>
  
  <pre><code>git rm -r --cached data/
  </code></pre>
  
  <blockquote>
    <p>fatal: pathspec 'data/' did not match any files</p>
  </blockquote>
  
  <pre><code>git rm -r data/
  </code></pre>
  
  <blockquote>
    <p>fatal: pathspec 'data/' did not match any files</p>
  </blockquote>
  
  <pre><code>git rm -r --cached data/**
  </code></pre>
  
  <blockquote>
    <p>fatal: pathspec 'data/journal/' did not match any files</p>
  </blockquote>
  
  <p>To me it seems like these files are not tracked by git. Why is it trying to sync them ?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I changed the content of my .gitignore to</p>
  
  <pre><code>data/
  </code></pre>
  
  <p>same problem.
  Then I tried </p>
  
  <pre><code>data/**
  </code></pre>
  
  <p>the error persists.</p>
  
  <pre><code>cat .gitignore
     data/
  git rm -r --cached
  git add .
  git add *
     The following paths are ignored by one of your .gitignore files:
     data
     Use -f if you really want to add them.
     fatal: no files added
  git commit -m "untracked data"
      On branch master
      nothing to commit, working directory clean
  ls
      app.js      app.ts  data/         node_modules/  public/  views/
      app.js.map  bin/    definitions/  package.json   routes/
  
  git push --set-upstream origin master
      Username for 'https://github.com': lhk
      Password for 'https://lhk@github.com': 
      Counting objects: 1486, done.
      Delta compression using up to 8 threads.
      Compressing objects: 100% (1342/1342), done.
      Writing objects: 100% (1486/1486), 3.71 MiB | 561.00 KiB/s, done.
      Total 1486 (delta 306), reused 2 (delta 0)
      remote: warning: File data/krauterkontor.0 is 64.00 MB; this is larger than  
      Github's recommended maximum file size of 50 MB
      remote: warning: File data/local.0 is 64.00 MB; this is larger than GitHub's     
      recommended maximum file size of 50 MB
      remote: error: GH001: Large files detected.
      remote: error: Trace: 3082472065ce69786a2ff7d409d1cb92
      remote: error: See http://git.io/iEPt8g for more information.
      remote: error: File data/journal/j._0 is 1024.00 MB; this exceeds GitHub's file size 
      limit of 100 MB
      remote: error: File data/journal/prealloc.1 is 1024.00 MB; this exceeds GitHub's file 
      size limit of 100 MB
      To https://github.com/lhk/krauterkontor
       ! [remote rejected] master -&gt; master (pre-receive hook declined)
      error: failed to push some refs to 'https://github.com/lhk/******'
  </code></pre>
  
  <p>What is going on there ? First it doesn't add data/, then it tries to push it.</p>
  
  <pre><code>git rm -r data/
      fatal: pathspec 'data/' did not match any files
  </code></pre>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>I really didn't know how to solve this, since it was the first commit to an empty repository, I chose an ugly solution. I just renamed the folder, cloned the repo again, copied all the code to the new folder, added a correct .gitignore and pushed the commit. This worked fine.</p>
  
  <p>Unfortunately I can no longer reproduce the issue, the question is no longer valid.</p>