Search code examples
githubpersonal-access-tokengit-authentication

How to reauthenticate using Github Personal Access Token, PAT has expired?


The PAT that I used for the past month has expired, I am unable to push changes to the repository, how should I go about creating a new token or reauthenticate using my password?


Solution

  • I had the same issue. There is a regenerate token button that allows to set a new end-date, but it doesn't produce a new PAT nor re-vive the old PAT.
    The only thing that worked for me is generate a new token and replace them in the .git/config files (or use the equivalent git config command).

    All in all, I think using an SSH url with github ([email protected]:<user>/<repo>.git) and publishing your public SSH key as authorized key in github is much more proven and convenient, even though github (microsoft) doesn't encourage it.

    See also Message "Support for password authentication was removed. Please use a personal access token instead." for a convenient method to change the expired PAT centrally.