feat: update git credential

This commit is contained in:
2026-06-26 11:10:23 +08:00
parent 84c7f37c53
commit 9551225ee9
7 changed files with 66 additions and 33 deletions
+2 -24
View File
@@ -1,25 +1,3 @@
#!/bin/bash
# Linux 凭据 helper:优先 libsecret,否则回退 cache 并提示安装
set -euo pipefail
warn_missing_libsecret() {
local marker="${XDG_CACHE_HOME:-$HOME/.cache}/git-credential-linux.warned"
[[ -f "$marker" ]] && return 0
mkdir -p "$(dirname "$marker")"
touch "$marker"
cat >&2 <<'EOF'
提示: 未找到 git-credential-libsecret,当前使用内存缓存(默认 1 周过期或登出后失效)。
安装持久化凭据存储:
Debian/Ubuntu: sudo apt install libsecret-1-0 git-credential-libsecret
Fedora/RHEL: sudo dnf install git-credential-libsecret
Arch Linux: sudo pacman -S libsecret git
EOF
}
if command -v git-credential-libsecret >/dev/null 2>&1; then
exec git-credential-libsecret "$@"
fi
warn_missing_libsecret
exec git-credential-cache --timeout=604800 "$@"
# 已合并到 git-credential.sh;保留此文件仅为兼容旧配置引用
exec "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/git-credential.sh" "$@"