github.com_burnett01_rsync-.../docker-rsync/hosts-init
Steven 1002e5f311
fix: only attempt to create file if it doesn't exist yet
On self-hosted runners it can happen that an action (docker container) is cached, resulting in aborting this script because the know_hosts file already exists. 
This if clause fixes it.
Setting permissions is intentionally outside the if clause because in all cases we want to reset perms.
2025-12-07 12:33:49 +01:00

9 lines
133 B
Bash
Executable file

#!/bin/sh
set -eu
if [ ! -f "$HOME/.ssh/known_hosts" ]; then
touch $HOME/.ssh/known_hosts
fi
chmod 600 $HOME/.ssh/known_hosts