Avoid macOS keychain in Section 0 helper

This commit is contained in:
virgil
2026-06-08 10:06:07 -07:00
parent ef463785da
commit aedd24ba18

View File

@@ -118,11 +118,15 @@ install_git_credential() {
host="\$(credential_host "\$remote")"
protocol="\$(printf "%s" "\$remote" | sed -n "s#^\\([^:/]*\\)://.*#\\1#p")"
[ -n "\$protocol" ] || protocol="http"
if [ "\$(uname -s 2>/dev/null || true)" = "Darwin" ]; then
git -C "\$REPO_DIR" config credential.helper osxkeychain
fi
mkdir -p "\$SESSION_DIR"
credential_path="\$SESSION_DIR/git-credentials"
touch "\$credential_path"
chmod 600 "\$credential_path"
git -C "\$REPO_DIR" config --local --replace-all credential.helper ""
git -C "\$REPO_DIR" config --local --add credential.helper "store --file=\$credential_path"
printf "protocol=%s\nhost=%s\nusername=%s\npassword=%s\n\n" "\$protocol" "\$host" "\$username" "\$password" \
| git -C "\$REPO_DIR" credential approve
chmod 600 "\$credential_path"
}
auth_login() {
@@ -142,6 +146,13 @@ auth_login() {
echo "Token check:"
echo " \$SERVER_URL/device/\$code/token"
open_url "\$auth_url"
if [ "\${SECTION0_AUTH_POLL:-}" != "1" ]; then
echo "When the browser says login succeeded, return here and press Enter."
printf "Press Enter to finish login: "
IFS= read -r _section0_continue
auth_finish "\$code"
return
fi
echo "Waiting for login..."
token_json=""
i=0