https://github.com/kielabokkie/ssh-key-and-known-hosts-action
Setup private key and add host to known hosts
https://github.com/kielabokkie/ssh-key-and-known-hosts-action
action github-actions hacktoberfest ssh
Last synced: 3 months ago
JSON representation
Setup private key and add host to known hosts
- Host: GitHub
- URL: https://github.com/kielabokkie/ssh-key-and-known-hosts-action
- Owner: kielabokkie
- License: mit
- Created: 2020-02-05T06:04:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T20:32:22.000Z (over 1 year ago)
- Last Synced: 2024-05-01T14:10:01.218Z (about 1 year ago)
- Topics: action, github-actions, hacktoberfest, ssh
- Language: JavaScript
- Homepage:
- Size: 379 KB
- Stars: 27
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Setup SSH Github Action
This action adds a SSH key and adds a given hostname or IP address to the known hosts file for external server access. It was heavily inspired by [atymic/deployer-php-action](https://github.com/atymic/deployer-php-action).
You can run this action before copying files to an external server using `scp` or `rsync` for example.
## Sponsor me
Did this action spark joy, or you find it useful? Please consider sponsoring me via [GitHub Sponsors](https://github.com/sponsors/kielabokkie). Thanks!
## Inputs
| Input | Required | Description
| ------------- | ------------- | ------------- |
| `ssh-private-key` | **Yes** | Private key required to access the host. |
| `ssh-host` | **Yes** | Hostname or IP address of the server you want to access. |
| `ssh-port` | Optional | Port for used for SSH on the host server (port 22 by default). |
| `ssh-socket` | Optional | The unix file socket that the agent uses for communication with other processes. |## Example usage
Just the required inputs:
```
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: your-server.com
```If your SSH port is different from the default you can change it:
```
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: your-server.com
ssh-port: 2222
```If you are using this action on concurrent builds the `ssh-socket` should be unique to prevent `address in use` issues:
```
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: your-server.com
ssh-socket: /tmp/ssh_agent_${{ github.sha }}.sock
```