Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
terminal

GitHub Action

SSH Setup

v1.0.1

SSH Setup

terminal

SSH Setup

Setup SSH

Installation

Copy and paste the following snippet into your .yml file.

              

- name: SSH Setup

uses: MrSquaare/[email protected]

Learn more about this action in MrSquaare/ssh-setup-action

Choose a version

ssh-setup-action

Setup SSH

Release Dependabot Codacy

Usage

name: Example

on: [push]

jobs:
  example:
    name: Example
    runs-on: ubuntu-latest
    steps:
    - name: Setup SSH
      uses: MrSquaare/ssh-setup-action@v1
      with:
        host: github.com
        private-key: ${{ secrets.SSH_PRIVATE_KEY }}

Examples

Single key and clone

name: Clone repository

on: [push]

jobs:
  clone:
    name: Clone
    runs-on: ubuntu-latest
    steps:
    - name: Setup SSH
      uses: MrSquaare/ssh-setup-action@v1
      with:
        host: github.com
        private-key: ${{ secrets.SSH_PRIVATE_KEY }}
    - name: Clone repository
      run: git clone [email protected]:username/repository.git

Multiple keys and multiple clone

name: Clone repositories

on: [push]

jobs:
  clone:
    name: Clone
    runs-on: ubuntu-latest
    steps:
    - name: Setup GitHub SSH
      uses: MrSquaare/ssh-setup-action@v1
      with:
        host: github.com
        private-key: ${{ secrets.SSH_PRIVATE_KEY_GITHUB }}
        private-key-name: github
    - name: Setup GitLab SSH
      uses: MrSquaare/ssh-setup-action@v1
      with:
        host: gitlab.com
        private-key: ${{ secrets.SSH_PRIVATE_KEY_GITLAB }}
        private-key-name: gitlab
    - name: Clone GitHub repository
      run: git clone [email protected]:username/repository.git
    - name: Clone GitLab repository
      run: git clone [email protected]:username/repository.git