How to add github personal access token to visual studio code
Follow these simple steps to setup Github authentication with Personal Access Token
Open Command line on your PC or Terminal on Mac
Set the current directory to your Project root
> cd C:\Users\Giddy\source\repo\MySampleProject
Run the command to set remote access via token
> git remote set-url origin https://username:token@github.com/username/repository.git
Example:
> git remote set-url origin https://sampleuser:a7b19929***58fe65d1c@github.com/sampleuser/sampleproject.git
If you get a message like this using the GitHub extension by KnisterPeter:
To enable the Visual Studio Code GitHub Support, please set a Personal Access Token
Go to Settings > Developer Settings > Personal Access Token
or go directly to https://github.com/settings/tokens
Click Generate New Token
Go back to VS Code and Open the Command Palette (Ctrl + Shift + P)
Type in Github: Set Personal Access Token
Paste in the value from your newly generated token
- In VSCode try push or pull from remote repo
- Click 'Signing into GitHub' message at bottom of VSCode
- Click 'Allow' in the prompt
- Enter token in the prompt that appears at top of VSCode
To see output related to GitHub authentication:
- Open terminal in VSCode
- Click 'Output' at top of terminal panel
- Click 'GitHub Authentication' from drop down menu
At time of writing I'm on VSCode v1.56.0