Initial commit: git-hangman-lab and keycloak-hangman-lab skills
This commit is contained in:
38
git-hangman-lab/scripts/git/create-git-account
Executable file
38
git-hangman-lab/scripts/git/create-git-account
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user