I'm using GitPython but did not find a way to push to repo using username and password. Can anybody send me a working example or give me some pointer about how to do it?
What I need to do is:
add a file to the repository, push it using the username and password provided.
解决方案
This is what I used for myself for pulling
pull.py
#! /usr/bin/env python3
import git
import os
from getpass import getpass
project_dir = os.path.dirname(os.path.abspath(__file__))
os.environ['GIT_ASKPASS'] = os.path.join(project_dir, 'askpass.py')
os.environ['GIT_USERNAME'] = username
os.environ['GIT_PASSWORD'] = getpass()
g = git.cmd.Git('/path/to/some/local/repo')
g.pull()
askpass.py (similar to this one)
This is in th