Set your Git config info
!git config --global user.email "your_email@example.com"
!git config --global user.name "your_github_username"
Define variables
GITHUB_USERNAME = "your_github_username"
GITHUB_TOKEN = "your_personal_access_token" # Create one in GitHub Settings > Developer Settings > Personal access tokens
REPO_NAME = "your_repo_name"
BRANCH = "main" # or "master"
Clone your repo (if not cloned yet)
!git clone https://{GITHUB_USERNAME}:{GITHUB_TOKEN}@github.com/{GITHUB_USERNAME}/{REPO_NAME}.git
%cd {REPO_NAME}
Make your changes here or upload files to repo folder
# Do something
Add and commit
!git add .
!git commit -m "Your commit message"
Push changes
!git push https://{GITHUB_USERNAME}:{GITHUB_TOKEN}@github.com/{GITHUB_USERNAME}/{REPO_NAME}.git {BRANCH}