fix opencode and gitea integration

This commit is contained in:
2026-04-05 21:09:15 +00:00
parent 30ccdab8af
commit 0e601a254e
3 changed files with 14 additions and 18 deletions

View File

@@ -1,26 +1,22 @@
#!/bin/bash
# Fix SSH directory and key permissions
# Fix SSH directory permissions
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_ed25519
# Add Gitea server to known_hosts (suppress errors if network unavailable)
ssh-keyscan -H git.processhub.work >> /root/.ssh/known_hosts 2>/dev/null || true
# Copy known_hosts to tmp if it's read-only (from host mount)
cp /root/.ssh/known_hosts /tmp/known_hosts 2>/dev/null || touch /tmp/known_hosts
chmod 600 /tmp/known_hosts
# Allow outbound SSH to Gitea
GITEA_IP=$(getent hosts git.processhub.work | awk '{print $1}' | head -1)
if [ -n "$GITEA_IP" ]; then
iptables -A OUTPUT -p tcp --dport 22 -d "$GITEA_IP" -j ACCEPT 2>/dev/null || true
fi
# Add Gitea to known_hosts
ssh-keyscan -H git.processhub.work >> /tmp/known_hosts 2>/dev/null || true
# Configure SSH to use the correct key
export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_ed25519 -o StrictHostKeyChecking=accept-new"
# Configure SSH
export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/tmp/known_hosts -o StrictHostKeyChecking=accept-new"
# Configure git user
# Git config
git config --global user.email "gabriel.pereira@protonmail.com"
git config --global user.name "gabspereira"
# Configure git safe directory (system-wide + workspace specific)
git config --system --add safe.directory '*'
git config --global --add safe.directory /workspace