Add safe Git publishing scripts

This commit is contained in:
Cowork committed 2026-11-17 14:13:15 +03:00
1 parent 2fc3568484
commit 1b93f77484
4 files changed
+39

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
HOST="git.itguild.info"
USER_NAME="${1:-apuc}"
# Keep the token out of shell history, process arguments, and project files.
read -r -s -p "Введите персональный токен Git для ${USER_NAME}: " TOKEN
printf '\n'
if [[ -z "$TOKEN" ]]; then
echo "Токен пустой — ничего не сохранено." >&2
exit 1
fi
# Cache credentials in memory for up to 30 days (lost on reboot/cache expiry).
git config --global credential.helper 'cache --timeout=2592000'
printf 'protocol=https\nhost=%s\nusername=%s\npassword=%s\n\n' "$HOST" "$USER_NAME" "$TOKEN" | git credential approve
unset TOKEN
echo "Git credential-cache настроен для HTTPS; секрет сохранён только в памяти."