Automating Git Push with SSH Keys in Scripts

Goal

Push to GitHub from an automated script using SSH authentication.

Setup

Configure SSH key and push:

mkdir -p ~/.ssh
echo "${{ secrets.GITHUB_SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
git push git@github.com:bustroker/bkr.hobies.web.git

The chmod 600 is required - SSH will reject keys with overly permissive permissions.