Open ghost opened 2 years ago
GitPython docs https://gitpython.readthedocs.io/en/stable/
Or perhaps not? I tried manually doing
git clone https://{holmesrichards}:{redacted PAT}@github.com/holmesrichards/Protoboard.git
then committed a change and tried to push it:
$ git push
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/holmesrichards/Protoboard.git/'
On the other hand, I tried
git clone https://github.com/holmesrichards/Protoboard.git
made a change and pushed it; I entered the same username and PAT at the prompts, and it worked. Note that it asks for username and "password" (PAT) on every push, not just the first.
So I dunno.
GitHub seems to want you to use GitHub CLI or Git Credential Manager:
On Discourse you wrote: "Normally when you first try and interact with remotes it opens up a browser window where it lets you login to GitHub ." I've never seen that behavior. It sounds like how GCM is described. Is that what you are using?
Seems you're using os.system() to issue git commands. Have you looked into the GitPython library? I've never used it but it might have advantages. The top answer here might be useful: https://stackoverflow.com/questions/44784828/gitpython-git-authentication-using-user-and-password
It involves storing the username and PAT in .git/config.
Using ssh authentication instead of https with PAT would presumably work too, but would probably require some manual setup. Doing the above I think could be transparent.