Use global SSH key for Gitea checkout
Build and Deploy / build-and-deploy (push) Failing after 4s

This commit is contained in:
Ketan Patel committed 2026-06-19 19:03:21 -04:00
1 parent 3061bc4d1b
commit c7e949b074
1 file changed
+12
+12
View File
@@ -20,13 +20,25 @@ jobs:
steps:
- name: Checkout
shell: bash
env:
GITEA_SSH_PRIVATE_KEY: ${{ secrets.GITEA_SSH_PRIVATE_KEY }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
git init .
checkout_key="${GITEA_SSH_PRIVATE_KEY:-${SSH_PRIVATE_KEY:-${DEPLOY_KEY:-}}}"
if [[ -z "$checkout_key" ]]; then
echo "::error::No global SSH checkout key found. Configure GITEA_SSH_PRIVATE_KEY, SSH_PRIVATE_KEY, or DEPLOY_KEY."
exit 1
fi
mkdir -p ~/.ssh
chmod 700 ~/.ssh
printf '%s\n' "$checkout_key" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p 2222 git.k2patel.in >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
git remote add origin "ssh://git@git.k2patel.in:2222/k2patel/apcupsd-client.git"
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes" \
git -c protocol.version=2 fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/origin/main
git checkout --force refs/remotes/origin/main