I created a new repository on github.com and then cloned it to my local machine with
git clone https://github.com/usrname/mathematics.git
I
I tried to use the GitHub API to commit multiple files. This page for the Git Data API says that it should be "pretty simple". For the results of that investigation, see this answer.
I recommend using something like GitPython:
from git import Repo
repo_dir = 'mathematics'
repo = Repo(repo_dir)
file_list = [
'numerical_analysis/regression_analysis/simple_regression_analysis.py',
'numerical_analysis/regression_analysis/simple_regression_analysis.png'
]
commit_message = 'Add simple regression analysis'
repo.index.add(file_list)
repo.index.commit(commit_message)
origin = repo.remote('origin')
origin.push()
Note: This version of the script was run in the parent directory of the repository.