In this short post I will demonstrate how to clone a private github repository with a personal access token.

From github.com/settings/tokens select the scopes:

  • repo:status
  • repo_deployment
  • public_repo
  • repo:invite
  • security_events

You will receive a token which you need to keep in a safe place.

Set your token in your git clone string:

$ git clone https://${TOKEN}:x-oauth-basic@github.com/MyUser/MyRepo.git

Resources: