Setup SSH
This GitHub action helps you to setup SSH.
It support Node.js 20+ for Linux and macOS runners.
name: Example
on: [push]
jobs:
example:
name: Example
runs-on: ubuntu-latest
steps:
- name: Setup SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: github.com
private-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 repository
on: [push]
jobs:
clone:
name: Clone
runs-on: ubuntu-latest
steps:
- name: Setup SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Clone repository
run: git clone [email protected]:username/repository.git
name: Clone repositories
on: [push]
jobs:
clone:
name: Clone
runs-on: ubuntu-latest
steps:
- name: Setup GitHub SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY_GITHUB }}
private-key-name: github
- name: Setup GitLab SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: gitlab.com
private-key: ${{ secrets.SSH_PRIVATE_KEY_GITLAB }}
private-key-name: gitlab
- name: Setup Server SSH with custom port
uses: MrSquaare/ssh-setup-action@v3
with:
host: 1.2.3.4
port: 8000
private-key: ${{ secrets.SSH_PRIVATE_KEY_GITLAB }}
private-key-name: server
- name: Clone GitHub repository
run: git clone [email protected]:username/repository.git
- name: Clone GitLab repository
run: git clone [email protected]:username/repository.git
- name: SSH to server
run: ssh -p 8000 [email protected] '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.
SSH Setup is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.