title: What's the most straightforward way to clone an empty, *bare* git repository?
body: <p>I've just finished cruising the Google search results that contain all the email rants about how stupid it is that git can't clone an empty repository.  Some kind soul even submitted a patch.  Until git is upgraded, what is the simplest, most straightforward method to clone an empty, <em>bare</em> git repository?</p>
  
  <p>The ideal solution will support the <code>-o</code> option to give the remote repo a name other than <code>origin</code>, and it will be implementable as a simple shell script, e.g., <code>git-clone-empty-repo</code>.</p>
  
  <p>(Why I want to do this: I've set up a bare, empty git repo on our NetApp filer where it will be backed up, but I want to work with a clone on my local hard drive and push and pull back and forth.  Other people I work with will be doing the same.  I create new git repos a lot and my inability to clone an empty repo makes me crazy.)</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: VonC's thread suggests that</p>
  
  <pre><code>$ git-init
  $ git-remote add origin server:/pub/git/test.git
  </code></pre>
  
  <p>is equivalent to cloning the remote repo when the repo is empty. This is not quite what I want because I always use the <code>-o</code> option with git clone; I name the remote repo according to what machine it is on or some other memorable criterion.  (I have too many repos to keep them straight if they're all called <code>origin</code>.)</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: The following answer will be marked accepted :-)</p>
  
  <p>To clone an empty, bare repo at <em>path</em>,</p>
  
  <ol>
  <li>Keep at <code>~/git/onefile</code> a non-bare git repo containing one innocuous file such as <code>.gitignore</code>.  (Alternatively, create such a repo dynamically.)</li>
  <li><code>(cd ~/git/onefile; git push</code> <em>path</em> <code>master)</code></li>
  <li><code>git clone -o</code> <em>name</em> <em>path</em></li>
  </ol>
  
  <p>In other words, don't attempt to clone the empty repo, but rather after creating it, push to it a simple repo containing one innocuous file.  Then it is no longer empty and can be cloned.</p>
  
  <p>If someone does not beat me to it, I will post a shell script.</p>