Install private repository in build stage on GitHub Actions

You might try and include in your GitHub Action workflow the webfactory/ssh-agent action:

When running a GitHub Action workflow to stage your project, run tests or build images, you might need to fetch additional libraries or vendors from private repositories.

GitHub Actions only have access to the repository they run for.

So, in order to access additional private repositories:

  • create an SSH key with sufficient access privileges.
  • Then, use this action to make the key available with ssh-agent on the Action worker node.
  • Once this has been set up, git clone commands using ssh URLs will just work. Also, running ssh commands to connect to other servers will be able to use the key.

That would give a workflow like:

# .github/workflows/my-workflow.yml
            - actions/[email protected]
            # Make sure the @v0.4.1 matches the current version of the
            # action 
            - uses: webfactory/[email protected]
                  ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
            - ... other steps

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top