ObsiGate/git-use-token.sh
Bruno Charest 459bbe441d
Some checks failed
CI / lint (push) Failing after 4s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / security (push) Successful in 7s
Add backup files for TestVault and Vault notes
2026-06-02 12:24:14 -04:00

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