Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

How To Use Github Tokens on the Command Line

May 12, 2023 — Gregg Szumowski

GitHub’s access policy requires you to use tokens instead of username/password to update your repositories.

To 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]

Tags: github, tokens, motd, cli