Reset existing Gitea bootstrap password

This commit is contained in:
juvdiaz 2026-06-29 11:02:54 -06:00
parent 61db0ce277
commit 67d514bf59
1 changed files with 8 additions and 1 deletions

View File

@ -2971,7 +2971,14 @@ if ! sudo docker exec -u git "\${container_name}" gitea -c /data/gitea/conf/app.
--email "\${bootstrap_email}" \ --email "\${bootstrap_email}" \
--admin \ --admin \
--must-change-password=false >/tmp/homelab-gitea-user-create.log 2>&1; then --must-change-password=false >/tmp/homelab-gitea-user-create.log 2>&1; then
if ! sudo docker exec -u git "\${container_name}" gitea -c /data/gitea/conf/app.ini admin user list | awk -v user="\${bootstrap_user}" 'NR > 1 && \$2 == user { found = 1 } END { exit found ? 0 : 1 }'; then if sudo docker exec -u git "\${container_name}" gitea -c /data/gitea/conf/app.ini admin user list | awk -v user="\${bootstrap_user}" 'NR > 1 && \$2 == user { found = 1 } END { exit found ? 0 : 1 }'; then
sudo docker exec -u git "\${container_name}" gitea -c /data/gitea/conf/app.ini admin user change-password \
--username "\${bootstrap_user}" \
--password "\${bootstrap_password}" >/tmp/homelab-gitea-user-password.log 2>&1 || {
cat /tmp/homelab-gitea-user-password.log >&2
exit 1
}
else
cat /tmp/homelab-gitea-user-create.log >&2 cat /tmp/homelab-gitea-user-create.log >&2
exit 1 exit 1
fi fi