cuddle-rust-service-plan/scripts/setup_ssh.sh

25 lines
398 B
Bash
Raw Normal View History

2022-08-14 21:44:28 +02:00
#!/bin/sh
set -e
if [ ! -d ~/.ssh ]; then
mkdir -p ~/.ssh
chmod 700 ~/.ssh
fi
if [ -n "$SSH_KEY" ]; then
SSH_KEY_ID="$HOME/.ssh/id_ed25519"
2022-08-14 22:00:03 +02:00
echo $SSH_KEY | base64 -d > $SSH_KEY_ID
2022-08-14 21:44:28 +02:00
chmod 600 $SSH_KEY_ID
2022-08-14 21:51:26 +02:00
cat >$HOME/.ssh/config <<EOL
2022-08-14 22:30:08 +02:00
Host git.front.kjuulh.io
2022-08-14 21:52:24 +02:00
IdentityFile ${SSH_KEY_ID}
IdentitiesOnly yes
UserKnownHostsFile=/dev/null
StrictHostKeyChecking no
EOL
2022-08-14 21:51:26 +02:00
2022-08-14 21:44:28 +02:00
fi