gitpython git authentication using user and password

What worked well for me (worked with GitHub, self hosted BitBucket, most likely will work on GitLab too). Pre-requisites Note, that despite the name, password here is your access token generated by GitHub and NOT your GitHub password. from git import Repo full_local_path = “/path/to/repo/” username = “your-username” password = “your-password” remote = f”https://{username}:{password}@github.com/some-account/some-repo.git” Clone … Read more

How to check out a branch with GitPython

If the branch exists: repo.git.checkout(‘branchename’) If not: repo.git.checkout(‘-b’, ‘branchename’) Basically, with GitPython, if you know how to do it within command line, but not within the API, just use repo.git.action(“your command without leading ‘git’ and ‘action'”), example: git log –reverse => repo.git.log(‘–reverse’)

git log –follow, the gitpython way

For example, With range time: g = git.Git(“C:/path/to/your/repo”) loginfo = g.log(‘–since=2013-09-01′,’–author=KIM BASINGER’,’–pretty=tformat:’,’–numstat’) print loginfo Output: 3 2 path/in/your/solutions/some_file.cs You can see the added lines, removed lines and the file with these changes.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)