Add git helper scripts for Gitea authentication and pushing

This commit is contained in:
igny8
2025-11-09 10:56:50 +00:00
parent d880314def
commit 5205b0548c
2 changed files with 58 additions and 0 deletions

3
git-credential-helper.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo "username=salman"
echo "password=Salman@2025#"

55
push-to-gitea.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
# Script to push igny8 repository to Gitea
set -e
REPO_NAME="igny8"
GITEA_URL="http://git.igny8.com"
echo "🚀 Pushing igny8 repository to Gitea..."
echo ""
# Check if remote exists
if git remote get-url origin >/dev/null 2>&1; then
echo "✅ Remote 'origin' already configured"
git remote -v
else
echo "📝 Adding remote origin..."
# Try different URL formats
git remote add origin "${GITEA_URL}/${REPO_NAME}/${REPO_NAME}.git" 2>/dev/null || \
git remote add origin "${GITEA_URL}/root/${REPO_NAME}.git" 2>/dev/null || \
git remote add origin "${GITEA_URL}/admin/${REPO_NAME}.git" 2>/dev/null || \
echo "⚠️ Could not determine correct URL format"
fi
echo ""
echo "📤 Pushing to Gitea..."
echo ""
# Try to push
if git push -u origin main 2>&1; then
echo ""
echo "✅ Successfully pushed to Gitea!"
echo "📍 Repository URL: ${GITEA_URL}/${REPO_NAME}/${REPO_NAME}"
else
echo ""
echo "❌ Push failed. This usually means:"
echo " 1. The repository doesn't exist yet in Gitea"
echo " 2. Authentication is required"
echo ""
echo "📋 To create the repository:"
echo " 1. Visit ${GITEA_URL}"
echo " 2. Sign in or create an account"
echo " 3. Click '+' → 'New Repository'"
echo " 4. Name it '${REPO_NAME}' and create it"
echo " 5. Then run this script again: ./push-to-gitea.sh"
echo ""
echo "💡 Or create it via API with a token:"
echo " curl -X POST '${GITEA_URL}/api/v1/user/repos' \\"
echo " -H 'Authorization: token YOUR_TOKEN' \\"
echo " -H 'Content-Type: application/json' \\"
echo " -d '{\"name\":\"${REPO_NAME}\",\"private\":false}'"
exit 1
fi