title: How do I push new files to GitHub?
body: <p>I created a new repository on github.com and then cloned it to my local machine with</p>
  
  <pre><code>git clone https://github.com/usrname/mathematics.git
  </code></pre>
  
  <p>I added 3 new files under the folder <code>mathematics</code></p>
  
  <pre><code>$ tree 
  .
  ├── LICENSE
  ├── numerical_analysis
  │   └── regression_analysis
  │       ├── simple_regression_analysis.md
  │       ├── simple_regression_analysis.png
  │       └── simple_regression_analysis.py
  </code></pre>
  
  <p>Now, I'd like to upload 3 new files to my GitHub using Python, more specifically, <a href="https://github.com/PyGithub/PyGithub" rel="noreferrer">PyGithub</a>. Here is what I have tried:</p>
  
  <pre><code>#!/usr/bin/env python
  # *-* coding: utf-8 *-*
  from github import Github
  
  def main():
      # Step 1: Create a Github instance:
      g = Github("usrname", "passwd")
      repo = g.get_user().get_repo('mathematics')
  
      # Step 2: Prepare files to upload to GitHub
      files = ['mathematics/numerical_analysis/regression_analysis/simple_regression_analysis.py', 'mathematics/numerical_analysis/regression_analysis/simple_regression_analysis.png']
  
      # Step 3: Make a commit and push
      commit_message = 'Add simple regression analysis'
  
      tree = repo.get_git_tree(sha)
      repo.create_git_commit(commit_message, tree, [])
      repo.push()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>I don't know </p>
  
  <ul>
  <li>how to get the string <code>sha</code> for <code>repo.get_git_tree</code></li>
  <li>how do I make a connection between step 2 and 3, i.e. pushing specific files</li>
  </ul>
  
  <p>Personally, <a href="http://pygithub.readthedocs.io/en/stable/introduction.html" rel="noreferrer">PyGithub documentation</a> is not readable. I am unable to find the right api after searching for long time.</p>