I use the git integration with VSCode. I have my new token (obtained through the GitHub web interface). How do I put it in?
The VSCode docs suggest the following:
To execute the 'GitHub: Set Personal Access Token' type Ctrl+Shift+p in VSCode to open the command palette and type 'GitHub: Set Personal Access Token'. You will then be prompted to enter the token generated from GitHub.
This option isn't available in my git integration in VS code. How can I do it from the command line?
The problem with the top voted answer is that your token is written to the .git/config
file in plain text which exposes it for use by others or potential unintentional redistribution.
First, remove the existing credentials using the Credential Manager. For non-windows systems, remove your git credentials however appropriate. For Windows, see below.
The next time you perform a Git operation, you will be prompted for a username and password. Enter the new token as your password.
To clear credentials on Windows, open the Credential Manager (search "credential manager" in the Windows search box). Then select the "Windows Credentials" button, find Git, and click "remove".