title: Git fetch failing using jgit: Remote does not have <branchname> available for fetch
body: <p>I have a bare repo located at <code>main.git</code> and am trying to fetch a branch (<code>foo</code>, let's say) in another repo, <code>test</code>, which has only just been <code>git init</code>'d:</p>
  
  <pre><code>fetchtest/
    |- main.git/
    |- test/
         |- .git/
  </code></pre>
  
  <p>Using regular git commands, I can do a <code>git fetch ../main.git foo:foo</code> and this will make a new branch <code>foo</code> in <code>test/</code> and fetch the objects required for the branch. <strong>I then want to do the same thing but programmatically using JGit, ie not using the git CLI but using only Java code. There is no way I can use the git CLI:</strong></p>
  
  <pre><code>Git git = Git.init().setDirectory(new File("fetchtest/test/")).call();
  
  git.fetch().setRemote(new File("../main.git"))
             .setRefSpecs(new RefSpec("foo:foo"))
             .call();
  </code></pre>
  
  <p>but it just errors with:</p>
  
  <pre><code>org.eclipse.jgit.api.errors.TransportException: Remote does not have foo available for fetch.
      at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:137)
      // ......
  Caused by: org.eclipse.jgit.errors.TransportException: Remote does not have foo available for fetch.
      at org.eclipse.jgit.transport.FetchProcess.expandSingle(FetchProcess.java:349)
      at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:139)
      at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:113)
      at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1069)
      at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128)
  </code></pre>
  
  <p>How do I get this to work?</p>