Add GUI git-askpass so credential prompts work without a TTY

Installs /usr/local/bin/git-askpass (uses zenity or qarma) and sets
core.askPass in /etc/gitconfig. Git now pops a GUI dialog for username/
password instead of trying to open /dev/tty, which fails in headless
contexts (scripts, Claude Code terminal).

Adds zenity to live desktop package lists for both niri and cinnamon profiles.
Propagated to: both live ISO builders and the installer postinstall.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
moze
2026-04-25 13:04:54 +00:00
parent 106fa940d7
commit 40f4efceed
5 changed files with 50 additions and 9 deletions

View File

@@ -91,6 +91,7 @@ python3
upower upower
power-profiles-daemon power-profiles-daemon
wl-clipboard wl-clipboard
zenity
# --- XDG portals --- # --- XDG portals ---
xdg-desktop-portal xdg-desktop-portal

View File

@@ -15,6 +15,7 @@ sudo
bash bash
bash-completion bash-completion
git git
zenity
curl curl
wget wget
vim vim

View File

@@ -88,10 +88,23 @@ EOF
fi fi
chmod 440 "$TARGET/etc/sudoers.d/10-wheel" chmod 440 "$TARGET/etc/sudoers.d/10-wheel"
# git: use file-based credential store so push/pull never tries to open /dev/tty # git: GUI askpass so prompts work without a controlling terminal
install -d -m 0755 "$TARGET/usr/local/bin"
cat > "$TARGET/usr/local/bin/git-askpass" <<'EOF'
#!/bin/sh
for cmd in zenity qarma; do
command -v "$cmd" >/dev/null 2>&1 || continue
case "$1" in
*[Uu]sername*) exec "$cmd" --entry --title="Git Credentials" --text="$1" ;;
*) exec "$cmd" --password --title="Git Credentials" --text="$1" ;;
esac
done
printf '%s' "$1" >&2; read -r answer; printf '%s\n' "$answer"
EOF
chmod 0755 "$TARGET/usr/local/bin/git-askpass"
cat > "$TARGET/etc/gitconfig" <<'EOF' cat > "$TARGET/etc/gitconfig" <<'EOF'
[credential] [core]
helper = store askPass = /usr/local/bin/git-askpass
EOF EOF
ok "user '$USERNAME' created and added to: $USER_GROUPS" ok "user '$USERNAME' created and added to: $USER_GROUPS"

View File

@@ -653,10 +653,23 @@ EOF
install -d -m 0755 "$INCLUDE_DIR/etc/skel/.config/nixpkgs" install -d -m 0755 "$INCLUDE_DIR/etc/skel/.config/nixpkgs"
echo '{ allowUnfree = true; }' > "$INCLUDE_DIR/etc/skel/.config/nixpkgs/config.nix" echo '{ allowUnfree = true; }' > "$INCLUDE_DIR/etc/skel/.config/nixpkgs/config.nix"
# git: use file-based credential store so push/pull never tries to open /dev/tty # git: GUI askpass so prompts work without a controlling terminal
install -d -m 0755 "$INCLUDE_DIR/usr/local/bin"
cat > "$INCLUDE_DIR/usr/local/bin/git-askpass" <<'EOF'
#!/bin/sh
for cmd in zenity qarma; do
command -v "$cmd" >/dev/null 2>&1 || continue
case "$1" in
*[Uu]sername*) exec "$cmd" --entry --title="Git Credentials" --text="$1" ;;
*) exec "$cmd" --password --title="Git Credentials" --text="$1" ;;
esac
done
printf '%s' "$1" >&2; read -r answer; printf '%s\n' "$answer"
EOF
chmod 0755 "$INCLUDE_DIR/usr/local/bin/git-askpass"
cat > "$INCLUDE_DIR/etc/gitconfig" <<'EOF' cat > "$INCLUDE_DIR/etc/gitconfig" <<'EOF'
[credential] [core]
helper = store askPass = /usr/local/bin/git-askpass
EOF EOF
# ── 3g) Skel: .bash_profile sources .bashrc only (no first-login autorun) ── # ── 3g) Skel: .bash_profile sources .bashrc only (no first-login autorun) ──

View File

@@ -264,10 +264,23 @@ EOF
install -d -m 0755 "$INCLUDE_DIR/etc/skel/.config/nixpkgs" install -d -m 0755 "$INCLUDE_DIR/etc/skel/.config/nixpkgs"
echo '{ allowUnfree = true; }' > "$INCLUDE_DIR/etc/skel/.config/nixpkgs/config.nix" echo '{ allowUnfree = true; }' > "$INCLUDE_DIR/etc/skel/.config/nixpkgs/config.nix"
# git: use file-based credential store so push/pull never tries to open /dev/tty # git: GUI askpass so prompts work without a controlling terminal
install -d -m 0755 "$INCLUDE_DIR/usr/local/bin"
cat > "$INCLUDE_DIR/usr/local/bin/git-askpass" <<'EOF'
#!/bin/sh
for cmd in zenity qarma; do
command -v "$cmd" >/dev/null 2>&1 || continue
case "$1" in
*[Uu]sername*) exec "$cmd" --entry --title="Git Credentials" --text="$1" ;;
*) exec "$cmd" --password --title="Git Credentials" --text="$1" ;;
esac
done
printf '%s' "$1" >&2; read -r answer; printf '%s\n' "$answer"
EOF
chmod 0755 "$INCLUDE_DIR/usr/local/bin/git-askpass"
cat > "$INCLUDE_DIR/etc/gitconfig" <<'EOF' cat > "$INCLUDE_DIR/etc/gitconfig" <<'EOF'
[credential] [core]
helper = store askPass = /usr/local/bin/git-askpass
EOF EOF
# ── 3e) niri config.kdl in /etc/skel ─────────────────────────────────── # ── 3e) niri config.kdl in /etc/skel ───────────────────────────────────