Access Token for Private Composer Packages at Github
To generate a GitHub Personal Access Token we need to following steps to generate it.
- Go to https://github.com/settings/tokens.
- Click the Generate new token button.
- Enter a Note to identify the usage for this token, normally you will enter here things like your computer name, or project.
- 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
- Click Generate token.
Make sure to copy your new personal access token now. You won’t be able to see it again!
- 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.