Access Token for Private Composer Packages at Github

To generate a GitHub Personal Access Token we need to following steps to generate it.

  1. Go to https://github.com/settings/tokens.
  2. Click the Generate new token button.
  3. Enter a Note to identify the usage for this token, normally you will enter here things like your computer name, or project.
  4. Select scopes with the following options:
  • repo - Full control of private repositories
  • repo:status - Access commit status
  • repo_deployment - Access deployment status
  • public_repo - Access public repositories
  • repo:invite - Access repository invitations
  • security_events - Read and write security events
  1. Click Generate token.

Make sure to copy your new personal access token now. You won’t be able to see it again!

  1. Create a ~/.composer/auth.jsonfile if it doesn´t exists and add the following content.
{
    "github-oauth": {
        "github.com": "<your-key-goes-here>"
    }
}

That's it! You should be able to use composer require "nameofyour/package" without a prompt for your token.

Victor Yoalli

This is me.