title: github api v3 update reference returns a 422 "Object does not exist"
body: <p>For the context I'm trying to update a file through the GitHub API.
  Everything was fine until I tried to update the reference.</p>
  
  <p>According <a href="https://developer.github.com/v3/git/refs/#update-a-reference" rel="nofollow">to the doc</a>, below are the requests I forged and their returns.</p>
  
  <p>If anyone has an idea, I did find nothing to make it work.</p>
  
  <pre><code>$ curl -i -XPATCH -d '{"sha": "69d0a253406585d8faf616ce3ae0ff2453b346d7"}' -H "Authorization: token AUTH-TOKEN" https://api.github.com/repos/Trax-air/TraxIT/git/refs/heads/ci-migrate-quay
  HTTP/1.1 422 Unprocessable Entity
  Server: GitHub.com
  Date: Wed, 18 Nov 2015 14:08:49 GMT
  Content-Type: application/json; charset=utf-8
  Content-Length: 128
  Status: 422 Unprocessable Entity
  X-RateLimit-Limit: 5000
  X-RateLimit-Remaining: 4948
  X-RateLimit-Reset: 1447856141
  X-OAuth-Scopes: gist, read:repo_hook, repo, user
  X-Accepted-OAuth-Scopes:
  X-GitHub-Media-Type: github.v3
  X-XSS-Protection: 1; mode=block
  X-Frame-Options: deny
  Content-Security-Policy: default-src 'none'
  Access-Control-Allow-Credentials: true
  Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
  Access-Control-Allow-Origin: *
  Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  X-Content-Type-Options: nosniff
  X-GitHub-Request-Id: 4EC2914C:94AC:15486DB6:564C8671
  
  {
    "message": "Object does not exist",
    "documentation_url": "https://developer.github.com/v3/git/refs/#update-a-reference"
  }
  </code></pre>
  
  <p>I tried to update the reference by itself, it worked:</p>
  
  <pre><code>$ curl -i -XPATCH -d '{"sha": "694973310d80edfe9ca08bd2fd5a06a6407b08ad"}' -H "Authorization: token AUTH-TOKEN" https://api.github.com/repos/Trax-air/TraxIT/git/refs/heads/ci-migrate-quay
  HTTP/1.1 200 OK
  Server: GitHub.com
  Date: Wed, 18 Nov 2015 14:10:20 GMT
  Content-Type: application/json; charset=utf-8
  Content-Length: 337
  Status: 200 OK
  X-RateLimit-Limit: 5000
  X-RateLimit-Remaining: 4947
  X-RateLimit-Reset: 1447856141
  Cache-Control: private, max-age=60, s-maxage=60
  ETag: "25641a46e3d517196995aec80669dcd2"
  X-OAuth-Scopes: gist, read:repo_hook, repo, user
  X-Accepted-OAuth-Scopes:
  Vary: Accept, Authorization, Cookie, X-GitHub-OTP
  X-GitHub-Media-Type: github.v3
  X-XSS-Protection: 1; mode=block
  X-Frame-Options: deny
  Content-Security-Policy: default-src 'none'
  Access-Control-Allow-Credentials: true
  Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
  Access-Control-Allow-Origin: *
  Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  X-Content-Type-Options: nosniff
  Vary: Accept-Encoding
  X-Served-By: c6c65e5196703428e7641f7d1e9bc353
  X-GitHub-Request-Id: 4EC2914C:94AB:F33F280:564C86CC
  
  {
    "ref": "refs/heads/ci-migrate-quay",
    "url": "https://api.github.com/repos/Trax-air/TraxIT/git/refs/heads/ci-migrate-quay",
    "object": {
      "sha": "694973310d80edfe9ca08bd2fd5a06a6407b08ad",
      "type": "commit",
      "url": "https://api.github.com/repos/Trax-air/TraxIT/git/commits/694973310d80edfe9ca08bd2fd5a06a6407b08ad"
    }
  }
  </code></pre>
  
  <p>I then tried to confirm my commit exist:</p>
  
  <pre><code>$curl -i -XGET -H "Authorization: token AUTH-TOKEN" https://api.github.com/repos/Trax-air/TraxIT/git/commits/69d0a253406585d8faf616ce3ae0ff2453b346d7
  
  HTTP/1.1 200 OK
  Server: GitHub.com
  Date: Wed, 18 Nov 2015 14:03:29 GMT
  Content-Type: application/json; charset=utf-8
  Content-Length: 1028
  Status: 200 OK
  X-RateLimit-Limit: 5000
  X-RateLimit-Remaining: 4950
  X-RateLimit-Reset: 1447856141
  Cache-Control: private, max-age=60, s-maxage=60
  Last-Modified: Wed, 18 Nov 2015 11:58:58 GMT
  ETag: "4823502d472e3b3fe873841fcd60d3c6"
  X-OAuth-Scopes: gist, read:repo_hook, repo, user
  X-Accepted-OAuth-Scopes:
  Vary: Accept, Authorization, Cookie, X-GitHub-OTP
  X-GitHub-Media-Type: github.v3
  X-XSS-Protection: 1; mode=block
  X-Frame-Options: deny
  Content-Security-Policy: default-src 'none'
  Access-Control-Allow-Credentials: true
  Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
  Access-Control-Allow-Origin: *
  Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
  X-Content-Type-Options: nosniff
  Vary: Accept-Encoding
  X-Served-By: 8a5c38021a5cd7cef7b8f49a296fee40
  X-GitHub-Request-Id: 4EC2914C:94AA:AE467E1:564C8530
  
  
  {
    "sha": "69d0a253406585d8faf616ce3ae0ff2453b346d7",
    "url": "https://api.github.com/repos/Trax-air/TraxIT/git/commits/69d0a253406585d8faf616ce3ae0ff2453b346d7",
    "html_url": "https://github.com/Trax-air/TraxIT/commit/69d0a253406585d8faf616ce3ae0ff2453b346d7",
    "author": {
      "name": "traxbot",
      "email": "traxbot@trax-air.com",
      "date": "2015-11-18T11:58:58Z"
    },
    "committer": {
      "name": "traxbot",
      "email": "traxbot@trax-air.com",
      "date": "2015-11-18T11:58:58Z"
    },
    "tree": {
      "sha": "ca47cb13f520913e643b15e6d0776f38ba577091",
      "url": "https://api.github.com/repos/Trax-air/TraxIT/git/trees/ca47cb13f520913e643b15e6d0776f38ba577091"
    },
    "message": "Updated api_gateway to 0.15",
    "parents": [
      {
        "sha": "694973310d80edfe9ca08bd2fd5a06a6407b08ad",
        "url": "https://api.github.com/repos/Trax-air/TraxIT/git/commits/694973310d80edfe9ca08bd2fd5a06a6407b08ad",
        "html_url": "https://github.com/Trax-air/TraxIT/commit/694973310d80edfe9ca08bd2fd5a06a6407b08ad"
      }
    ]
  }
  </code></pre>