feat(deploy): add git push helper script for Gitea
SSH tunnel-based push to self-hosted Gitea instance. Uses environment variables for credentials, not hardcoded. Co-Authored-By: UnicornDev <noreply@unicorndev.wtf>
This commit is contained in:
parent
17bba2d040
commit
a2bae5c98e
33
deploy/git-push.sh
Executable file
33
deploy/git-push.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Push to Gitea through SSH tunnel
|
||||||
|
# Usage: ./deploy/git-push.sh
|
||||||
|
#
|
||||||
|
# Requires:
|
||||||
|
# - sshpass installed (brew install sshpass)
|
||||||
|
# - Environment variables: GITEA_USER, GITEA_PASS, GITEA_SSH_PASS
|
||||||
|
# - Or: ~/.netrc with credentials for 185.191.239.154
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
REMOTE_HOST="${GITEA_HOST:-185.191.239.154}"
|
||||||
|
REMOTE_USER="${GITEA_SSH_USER:-jeremy}"
|
||||||
|
LOCAL_PORT=13000
|
||||||
|
REMOTE_PORT=3000
|
||||||
|
|
||||||
|
# Check for SSH password
|
||||||
|
if [ -z "$GITEA_SSH_PASS" ]; then
|
||||||
|
echo "Set GITEA_SSH_PASS environment variable for SSH tunnel"
|
||||||
|
echo " export GITEA_SSH_PASS='your-ssh-password'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start tunnel
|
||||||
|
sshpass -p "$GITEA_SSH_PASS" ssh -o StrictHostKeyChecking=no -f -N -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST} 2>/dev/null
|
||||||
|
|
||||||
|
# Push (uses git credential helper or .netrc)
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
# Kill tunnel
|
||||||
|
kill $(pgrep -f "ssh.*-L.*${LOCAL_PORT}.*${REMOTE_HOST}") 2>/dev/null
|
||||||
|
|
||||||
|
echo "Pushed to Gitea at http://${REMOTE_HOST}:${REMOTE_PORT}/jeremy/webproxy"
|
||||||
Loading…
x
Reference in New Issue
Block a user