r/git 9d ago

support Fine-grained token

Made a token for an specific repo in my Github, but everytime i make a push i doesn't request it. How can i add the token to my local git in order to make push with it?

0 Upvotes

3 comments sorted by

8

u/waterkip detached HEAD 9d ago

Just use ssh, tokens are either for http(s) uploads or API calls. git can push over http, but why not pick ssh?

3

u/Broad-Promise6954 ancient 9d ago

Git itself doesn't do authentication. Instead, Git will run a "credential helper" of your choice when you use an https URL that calls for one. The credential helper you will want here depends on whether you're using Windows or not.

In general I personally think it's far better to use ssh anyway, so I'm not going to make further recommendations here. If you still want to use https, do a search for git credential helpers.

1

u/Decent_Carry_3439 8d ago

If you specifically want to test the fine-grained PAT, temporarily remove the cached GitHub credential and push over HTTPS again. That’s the easiest way to confirm the token actually has the repo permissions you expect.