Question:
Is there a way to combine the advantages of GitHub's fine-grained PATs with the simplicity of git pull
over HTTPS? If so, then how?
Background
GitHub has "classic" and "fine-grained" personal access tokens (PATs):
Go to Settings > Developer Settings to see these.
I have been using a classic PAT to run git pull
commands over HTTPS, to pull the latest commits from GitHub:
git pull https://${token}@github.com/${owner}/${repo}.git
This works without prompting for a password (I keep the PAT's expiration period reasonably short).
I cannot just (naively) substitute a new fine-grained token for the classic token in my git pull
command. It prompts me for a password. (It is treated as a user ID, I assume.)
Fine-grained PATs certainly work with the GitHub REST API. I can use the API to get a commit if I have the commit SHA. But that is quite low-level compared to git pull
and I don't want to "reimplement a lot of Git functionality" (ref).
Fine-grained PATs are welcomed because of their ability to lock down access to specific repos and specific functions. But how (if at all) can they be used directly with git pull
commands?
I am using Git v2.38.1 (the latest release, currently).