Fix HTTPS to HTTP conversion for Gitea API

This commit is contained in:
tanyar09
2026-03-04 15:01:31 -05:00
parent edb409bb0c
commit 7db96541a6
10 changed files with 422 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Helper script to get Gitea API information from git remote
REMOTE=$(git remote get-url origin 2>/dev/null)
if [ -z "$REMOTE" ]; then
echo "Error: No git remote found"
exit 1
fi
# Extract host (assuming format: gitea@HOST:repo.git or ssh://gitea@HOST/repo.git)
if [[ $REMOTE == *"@"* ]]; then
HOST=$(echo "$REMOTE" | sed 's/.*@\([^:]*\).*/\1/')
else
HOST=$(echo "$REMOTE" | sed 's|.*://\([^/]*\).*|\1|')
fi
# Extract repo path (owner/repo)
REPO=$(echo "$REMOTE" | sed 's/.*:\(.*\)\.git/\1/' | sed 's|.*/\(.*/.*\)|\1|')
# Gitea typically runs on port 3000
API_BASE="http://${HOST}:3000/api/v1"
echo "GITEA_HOST=${HOST}"
echo "GITEA_REPO=${REPO}"
echo "GITEA_API_BASE=${API_BASE}"