Files
ClawSkills/git-hangman-lab/scripts/git/create-git-account

39 lines
833 B
Bash
Executable File

#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--username)
username="$2"
shift 2
;;
--email)
email="$2"
shift 2
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Check if username and email are provided
if [[ -z "$username" || -z "$email" ]]; then
echo "Usage: $0 --username <username> --email <email>"
exit 1
fi
# Generate git credentials (do not print secret)
pass_mgr generate --username "$username" --key git >/dev/null
# Create gitea user
"$SCRIPT_DIR/gitea" admin user create \
--username "$(pass_mgr get-username --key git)" \
--password "$(pass_mgr get-secret --key git)" \
--email "$email" \
--must-change-password=false