Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication with PAT #5

Open
ghost opened this issue Apr 27, 2022 · 2 comments
Open

Authentication with PAT #5

ghost opened this issue Apr 27, 2022 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Apr 27, 2022

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.

@ghost
Copy link
Author

ghost commented Apr 27, 2022

GitPython docs https://gitpython.readthedocs.io/en/stable/

@ghost
Copy link
Author

ghost commented Apr 27, 2022

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:

https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git

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?

@Sonosus Sonosus self-assigned this Apr 28, 2022
@Sonosus Sonosus pinned this issue Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant