title: Get GitHub repository URL from commit
body: <p>I would like to get a GitHub Repository URL from a Commit HASH. </p>
  
  <p>I quickly found this solution: </p>
  
  <pre><code>import json
  import requests
  
  def search_commits(sha):
     headers = {'Accept': 'application/vnd.github.cloak-preview'}
     req = requests.get('http://api.github.com/search/commits',
         {'q': sha},
         headers=headers)
     return json.loads(req.text)
  
  
  commit = search_commits('e83c5163316f89bfbde7d9ab23ca2e25604af290')['items'][0]
  clone_url = commit['repository']['url']
  </code></pre>
  
  <p>The I tried the same with <code>PyGitHub</code>:</p>
  
  <pre><code>from github import Github
  g = Github()
  
  commit = g.search_commits('e83c5163316f89bfbde7d9ab23ca2e25604af290')[0]
  </code></pre>
  
  <p>Unfortunately in this result (even in <code>commit.raw_data</code>) there is no key <code>repository</code>. </p>
  
  <p>It seems PyGitHub uses <code>search/commits</code> as described here: <a href="https://developer.github.com/v3/search/#search-commits" rel="nofollow noreferrer">https://developer.github.com/v3/search/#search-commits</a></p>
  
  <p>How can I get the URL of the repository?</p>
  
  <p>One possible kludge would be: </p>
  
  <pre><code>import re
  
  repo = g.get_repo(
      re.search('repos/(.*?)/commits', c.raw_data['url']).group(1)
  )
  clone_url = repo.clone_url
  </code></pre>