Compare commits

...
Author SHA1 Message Date
Patrick szymkowiak 6cee6c60b8 fix(git): inherit stdin for commit and push to preserve SSH signing (#733)
Command::output() sets stdin to Stdio::piped() by default, creating an
empty pipe instead of inheriting the terminal. SSH signing tools
(1Password, YubiKey, gpg-agent with pinentry) need TTY access on stdin
for passphrase prompts or agent communication. This caused signatures
to be silently dropped — commits succeeded but without gpgsig headers.

Fix: add .stdin(Stdio::inherit()) to git commit and git push commands
so they inherit the parent's stdin (terminal or hook pipe). Output
capture via stdout/stderr pipes is preserved.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-02 21:04:46 +02:00
+3 -1
View File
@@ -3,6 +3,7 @@
use crate::core::config;
use crate::core::tracking;
use crate::core::utils::{exit_code_from_output, exit_code_from_status, resolved_command};
use std::process::Stdio;
use anyhow::{Context, Result};
use std::ffi::OsString;
use std::process::Command;
@@ -908,6 +909,7 @@ fn run_commit(args: &[String], verbose: u8, global_args: &[String]) -> Result<i3
}
let output = build_commit_command(args, global_args)
.stdin(Stdio::inherit())
.output()
.context("Failed to run git commit")?;
@@ -972,7 +974,7 @@ fn run_push(args: &[String], verbose: u8, global_args: &[String]) -> Result<i32>
cmd.arg(arg);
}
let output = cmd.output().context("Failed to run git push")?;
let output = cmd.stdin(Stdio::inherit()).output().context("Failed to run git push")?;
let stderr = String::from_utf8_lossy(&output.stderr);
let stdout = String::from_utf8_lossy(&output.stdout);