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:
- 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.json
file 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.