How to add github personal access token to visual studio code How to add github personal access token to visual studio code git git

How to add github personal access token to visual studio code


Follow these simple steps to setup Github authentication with Personal Access Token

  1. Open Command line on your PC or Terminal on Mac

  2. Set the current directory to your Project root

    > cd C:\Users\Giddy\source\repo\MySampleProject

  3. 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

Enable Visual Studio Code GitHub Support

  1. Go to Settings > Developer Settings > Personal Access Token

    or go directly to https://github.com/settings/tokens

  2. Click Generate New Token

    Settings > Generate New Token

  3. Go back to VS Code and Open the Command Palette (Ctrl + Shift + P)

  4. Type in Github: Set Personal Access Token

    Set Personal Access Token

  5. Paste in the value from your newly generated token


  1. In VSCode try push or pull from remote repo
  2. Click 'Signing into GitHub' message at bottom of VSCode
  3. Click 'Allow' in the prompt
  4. Enter token in the prompt that appears at top of VSCode

To see output related to GitHub authentication:

  1. Open terminal in VSCode
  2. Click 'Output' at top of terminal panel
  3. Click 'GitHub Authentication' from drop down menu

At time of writing I'm on VSCode v1.56.0