kirche-einfach/.devcontainer/postStart.sh

19 lines
No EOL
607 B
Bash

#!/bin/bash
# Post-start hook: copies SSH keys from the host into the container, then
# adds the git host. Never fails the devcontainer run: any missing file on
# the host (e.g. no id_rsa) must not abort the lifecycle command.
set -u
mkdir -p ~/.ssh
for f in id_rsa id_rsa.pub known_hosts; do
cp -f "/mnt/host-ssh/$f" ~/.ssh/ 2>/dev/null || true
done
ssh-keyscan -t ed25519,rsa gitlab.jonas-miederer.com >> ~/.ssh/known_hosts 2>/dev/null || true
chmod 700 ~/.ssh 2>/dev/null || true
chmod 600 ~/.ssh/id_rsa 2>/dev/null || true
chmod 644 ~/.ssh/id_rsa.pub ~/.ssh/known_hosts 2>/dev/null || true
exit 0