Fix git credential helper setup

This commit is contained in:
MangoPig
2026-06-03 23:19:03 +01:00
parent cbfc097d60
commit 1c37bfeede

View File

@@ -109,6 +109,19 @@ download_and_verify_release_asset() {
rm -f "$checksum_file"
}
ensure_git_credential_helper() {
local helper_value="$1"
local existing_helpers=""
existing_helpers=$(git config --global --get-all credential.helper 2>/dev/null || true)
if printf '%s\n' "$existing_helpers" | grep -Fx -- "$helper_value" >/dev/null 2>&1; then
return 0
fi
git config --global --add credential.helper "$helper_value"
}
echo -e "${BLUE} LOG:${YELLOW} Initializing Base System Layer...${NC}"
# Confirm Architecture
@@ -383,9 +396,9 @@ mkdir -p "$ZSH_CUSTOM/plugins"
# 5. Git Credentials (WSL Bridge)
if is_wsl; then
GCM_WIN="/mnt/c/Program Files/Git/mingw64/bin/git-credential-manager.exe"
[ -f "$GCM_WIN" ] && git config --global credential.helper "! \"$GCM_WIN\""
[ -f "$GCM_WIN" ] && ensure_git_credential_helper "! \"$GCM_WIN\""
else
git config --global credential.helper 'cache --timeout=43200'
ensure_git_credential_helper 'cache --timeout=43200'
fi
# 6. Cleanup & Secrets