Skip to content

Instantly share code, notes, and snippets.

@jprivet-dev
Last active December 9, 2021 15:58
Show Gist options
  • Save jprivet-dev/26e27af0b5fb3e2c219c9fe1ebcf793f to your computer and use it in GitHub Desktop.
Save jprivet-dev/26e27af0b5fb3e2c219c9fe1ebcf793f to your computer and use it in GitHub Desktop.
Composer: Generate a Github Oauth token for privately hosted packages and repositories

Composer: Generate a Github Oauth token for privately hosted packages and repositories

Generate your personal access token

. Generate a new personal access token https://github.com/settings/tokens/new . Copy your token ghp_mytoken

Generate your auth.json

$ cd ~/.config/composer/auth.json`
$ composer config github-oauth.github.com ghp_mytoken

Verify your auth.json

$ cat ~/.config/composer/auth.json
{
    "github-oauth": {
        "github.com": "ghp_mytoken"
    }
}

Resources

. https://github.com/settings/tokens/new . https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment