Installing Private Repositories in Github Actions

I've recently been building a new laravel package locally and when I started using this in a new Laravel project I wanted to use Github Actions as the CI/CD process of the new project.

When developing a package locally it's easy to test as you can use the path property in composer to link the package to the project. But when you want to test this in a CI environment you need to install the package from a private repository. Which means I will need to change this to something like this.

    "repositories": [
            "type": "vcs",
            "url": "[email protected]:username/repo.git"

This will work fine when you are running composer install on your local machine because your git user will have access to this but it won't work in Github Actions because the user running the composer install won't have access to this repository.

We need to change this and give Github Action access to this repository.

To do this we can generate a new access token in Github and give full control to private repositories.

We can then take this generated token and add it to the repository secrets in Github under the key COMPOSER_AUTH.

We can now set up an env in our Github Actions file to use this token.

      - name: Install dependencies
          COMPOSER_AUTH: '{"github-oauth": {"": "${{secrets.COMPOSER_AUTH}}"} }'
        run: |
          composer install --prefer-dist --no-interaction --no-progress

This will now allow Github Actions to install the private repository from Github.

If you are using a different package manager you can use the same method to install the private repository.


Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring