
Below command will remove Git credentials such as PAT globally.
git config --global --unset credential.helper
While the one below will remove stored and cached Git credentials from specific repository you are in.
git config --unset credential.helper
After removing the credentials, you can reintroduce the new PAT by setting the remote url for origin or any other branch you are using as below:
Use git set-url to set the upstream url for pushing and fetching.
git set-url origin https://Your-PAT-here@>github.com/xyz-user/xyz-repo.git
The git remote -v command is used to view the remote repositories associated with your Git repository. It shows the names and URLs of the remote repositories that your local repository is configured to interact with.
git remote -v
You should get an output similar to below. This shows the urls associated with your repo and if the PAT tokens (before @ sign and after https://) look updated you are golden.
origin https://ghp_asHTAS236SDFkfd23fsDf2jf90fdj2sdsd2f2fW@github.com/user/xyz.git (fetch)
origin https://ghp_2KD3954VJDFV2384392JUWEVsdiwfw902hf@github.com/user/xyz.git (push)