This article shows the step to setup composer to install private Github repository.


On Github

1) Go to settings -> Developer Settings -> Personal Access Tokens -> Fine-grained tokens

2) Clicks on the "Generate new token" button.

3) Select an expiry period

4) Select a specific repo.

5) Provide "Contents" read-only access.

6) Generate and copy the token.


On Target Machine

1) Setup composer auth config by using the following command.

php composer.phar config -g github-oauth.github.com <token>