A GitHub Action that sets up ssh-agent with private SSH keys to enable secure access to private repositories and servers.
ssh-agent is a GitHub Action that configures an SSH agent and loads private keys during CI/CD workflows. It enables secure SSH access to private repositories, servers, and services that require SSH authentication, solving the limitation where GitHub Actions only have access to the current repository by default.
Developers and DevOps engineers building GitHub Actions workflows that need to fetch dependencies from private repositories, deploy to servers via SSH, or run commands requiring SSH authentication.
It provides a secure, standardized way to manage SSH keys in CI/CD pipelines without writing keys to disk, with special optimizations for GitHub deploy keys and support for complex scenarios like Docker builds with multiple private dependencies.
GitHub Action to setup ssh-agent with a private key
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The action loads private SSH keys directly into the ssh-agent without writing them to disk, adhering to security best practices for CI environments as emphasized in the README.
It supports loading multiple keys and intelligently maps GitHub deploy keys to specific repositories using SSH key comments, solving the issue of SSH servers aborting after too many wrong keys.
The action enables SSH agent forwarding into Docker builds via the SSH_AUTH_SOCK environment variable, allowing private Git dependency fetching during image construction, as documented with examples.
It is designed to work across Linux, Windows, and container-based GitHub Actions environments, though with noted caveats for newer platforms.
The README explicitly states that Windows and Docker support is 'somewhat new' and may not run smoothly, relying on user feedback for stability, which poses a risk for critical workflows.
Using multiple deploy keys inside Docker builds requires additional steps like copying Git and SSH config files and modifying Dockerfiles, adding significant complexity and potential for errors.
SSH keys are only available in the job where the action is used, as each job runs in a fresh instance, forcing repetition if multiple jobs need access, which can complicate workflow design.
The action requires private keys in PEM format, and non-PEM keys will cause an 'invalid format' error, necessitating manual conversion with ssh-keygen, an extra step for users.