Howto use github tokens on the command line

Klaas (khz)
Aug 16, 2021
(Picture: Pixabay / CC0 )

Howto setup a personal access token on github, adapt your local repos and clone new private repos with token based authentication.

GitHub changed it’s access policy from username/password to tokens. After an intermediate period in which both access / authentication versions were possible, since August 13th 2021 only tokens are allowed.

Create a user token:

Follow the instructions from the github docs

(Picture from github docs)

Adapt your existing local / cloned repos to token based auth:

git remote remove origin
git remote add origin https://[TOKEN]@github.com/[USER]/[REPO]
git push

Clone repos using token based authentication (non public repos)

git clone https://<username>:<token>@github.com/<accountname>/<reponame>

--

--

Klaas (khz)

11 to 1 pm spare time software developer. Mostly python.