Setup SSH
This GitHub action helps you to setup SSH.
Requires Runner v2.327.1 or later to run (Node.js 24 runtime).
name: Exampleon: [push]jobs:
example:
name: Exampleruns-on: ubuntu-lateststeps:
- name: Setup SSHuses: MrSquaare/ssh-setup-action@v4with:
host: github.comprivate-key: ${{ secrets.SSH_PRIVATE_KEY }}This action exports the following environment variables:
SSH_PATH: Path to SSH directorySSH_AGENT_PID: PID of SSH agentSSH_AUTH_SOCK: Path to SSH agent socket
This action set the following outputs:
ssh-path: Path to SSH directoryssh-agent-pid: PID of SSH agentssh-auth-sock: Path to SSH agent socket
name: Clone repositoryon: [push]jobs:
clone:
name: Cloneruns-on: ubuntu-lateststeps:
- name: Setup SSHuses: MrSquaare/ssh-setup-action@v4with:
host: github.comprivate-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Clone repositoryrun: git clone git@github.com:username/repository.gitname: Clone repositorieson: [push]jobs:
clone:
name: Cloneruns-on: ubuntu-lateststeps:
- name: Setup GitHub SSHuses: MrSquaare/ssh-setup-action@v4with:
host: github.comprivate-key: ${{ secrets.SSH_PRIVATE_KEY_GITHUB }}private-key-name: github
- name: Setup GitLab SSHuses: MrSquaare/ssh-setup-action@v4with:
host: gitlab.comprivate-key: ${{ secrets.SSH_PRIVATE_KEY_GITLAB }}private-key-name: gitlab
- name: Setup Server SSH with custom portuses: MrSquaare/ssh-setup-action@v4with:
host: 1.2.3.4port: 8000private-key: ${{ secrets.SSH_PRIVATE_KEY_CUSTOM }}private-key-name: server
- name: Clone GitHub repositoryrun: git clone git@github.com:username/repository.git
- name: Clone GitLab repositoryrun: git clone git@gitlab.com:username/repository.git
- name: SSH to serverrun: ssh -p 8000 ubuntu@1.2.3.4 'echo Hello'Bug reports, feature requests, other issues and pull requests are welcome. See CONTRIBUTING.md for more information.
Distributed under the MIT License. See LICENSE for more information.