title: Clone a repository from GitHub Enterprise with go-git
body: <p>I'm trying to use <code>go-git</code> to clone a repository from GitHub Enterprise. To do that, I'm using the HTTPS protocol with an access token with appropriate permissions for my repos (verified on the command line). <code>go-git</code> fails when making the <code>git-upload-pack</code> RPC call because the server responds with a 400:</p>
  
  <pre><code>$ go run main.go
  unexpected client error: unexpected requesting "https://github.mycompany.net/my-org/myrepo.git/info/refs?service=git-upload-pack" status code: 400
  </code></pre>
  
  <p>The request it makes is equivalent to this:</p>
  
  <pre><code>GET /my-org/myrepo.git/info/refs?service=git-upload-pack HTTP/1.1
  Host: github.mycompany.net
  User-Agent: git/1.0
  Accept: */*
  Authorization: Bearer atokenthatisdefinitelyvalid
  </code></pre>
  
  <p>Without the token in the request header, I get the expected 401 (<code>Anonymous access denied</code>) response from the repository. With the token, it responds with a 400. </p>
  
  <p>I have found the same to be true for public repositories on non-Enterprise GitHub; with the difference that it (expectedly) works without an <code>Authorization</code> header since none is necessary. If I include a valid token, GitHub just like its Enterprise version responds with a 400.</p>
  
  <p>Below is a minimal example. Is there a way to use <code>go-git</code> with GitHub Enterprise that requires authentication? Ideally using an auth token?</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "io/ioutil"
  
      git "gopkg.in/src-d/go-git.v4"
      "gopkg.in/src-d/go-git.v4/plumbing"
      "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
  )
  
  const (
      repoURL           = "https://github.mycompany.net/my-org/myrepo.git"
      githubAccessToken = "atokenthatisdefinitelyvalid"
  )
  
  func main() {
      dir, _ := ioutil.TempDir("", "temp_dir")
  
      options := &amp;git.CloneOptions{
          Auth:          &amp;http.TokenAuth{Token: githubAccessToken},
          URL:           repoURL,
          Depth:         500,
          ReferenceName: plumbing.ReferenceName("refs/heads/master"),
          SingleBranch:  true,
          Tags:          git.NoTags,
      }
  
      _, err := git.PlainClone(dir, false, options)
      fmt.Println(err)
  }
  </code></pre>