title: git archive --format=tar HEAD:mydir/ | tar t -> fatal: current working directory is untracked
body: <p>I'm trying to archive a folder in my git repository:</p>
  
  <pre><code>git archive --format=tar HEAD:mydir/ | tar t
  </code></pre>
  
  <p>However, the error message I'm getting is:</p>
  
  <pre><code>fatal: current working directory is untracked
  </code></pre>
  
  <p>The instructions I followed were <a href="https://stackoverflow.com/a/17351814/1033422">here</a>.</p>
  
  <p>My git version is: 2.1.2</p>
  
  <p>A <a href="https://www.google.co.uk/search?q=%22git%20archive%22%20fatal:%20current%20working%20directory%20is%20untracked&amp;ie=utf-8&amp;oe=utf-8&amp;gws_rd=cr&amp;ei=ZYlnVcjtLYmssgHknoHgBA#q=%22git%20archive%22%20%22fatal:%20current%20working%20directory%20is%20untracked%22" rel="nofollow noreferrer">google</a> search only came up with 6 links, all of them a few years old and didn't look relevant.</p>