Add safe Git publishing scripts
This commit is contained in:
1 parent
2fc3568484
commit
1b93f77484
4 files changed
+39
No files matched your search
Executable
+18
@@ -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; секрет сохранён только в памяти."
|
||||
Reference in new issue
Block a user