22 lines
573 B
Bash
22 lines
573 B
Bash
#!/bin/bash
|
|
# git-use-token.sh — Push to Gitea using token from .env
|
|
# Usage: ./git-use-token.sh [push args]
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# Load token from .env
|
|
if [ -f .env ]; then
|
|
export $(grep -v '^#' .env | grep GITEA_TOKEN | xargs)
|
|
fi
|
|
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
echo "❌ GITEA_TOKEN not found in .env"
|
|
exit 1
|
|
fi
|
|
|
|
# Set remote with token and push
|
|
git remote set-url origin "https://bruno:${GITEA_TOKEN}@git.dracodev.net/Projets/ObsiGate.git"
|
|
git push "$@"
|
|
|
|
# Restore clean remote URL
|
|
git remote set-url origin https://git.dracodev.net/Projets/ObsiGate.git |