Storing Github access token in git credential store


git operations were prompting the github access token despite having GITHUB_ACCESS_TOKEN environment variable in WSL2 on Windows


Go through the process of generating the github access token as mentioned in Github login using access token via cmdline blog


Run the following sequence of steps to seek the help of git's credential store on the machine to store the access token

git config --global credential.helper store

Run the following command, which will wait for the input from user. So it is expected that you will see a waiting prompt and not a completed command.

git credential-store --file ~/.git-credentials store

Essentially you are storing the access token in ~/.git-credentials file on disk

Now update the actual github access token against the username key in the following block and paste it at the waiting command prompt

leave the password= as blank, no need to specify a value


Hit Enter twice. This will save the credential and exit the command prompt

If you inspect the credential file, you should see something similar as below

$ cat ~/.git-credentials

That's it ! From now on, any git commands shouldn't prompt you for username (github user) and password (access token)

Latest Blogposts

How to find a linux machine is a VM (Virtual Machine) or a Bare Metal

If you can SSH into a linux machine and want to find out if its baremetal or Virtual Machine

7 November 2023

Token generation for Registering Self Hosted Github Runner via REST API

Explains how to generate a token using github API to be used in turn with Github self hosted runner registration

21 March 2023

Setting up a Self Hosted Github Runner

Explains how to setup a Github self hosted runner and register

20 March 2023

Managing the NodeJS versions on Windows

Node Version Manager (nvm) helps in managing multiple NodeJS versions

13 November 2022

Customizing the Powershell terminal with oh-my-posh

Instructions on customizing the terminal in powershell with oh-my-posh and winget

7 July 2022