Skip to content

Commit d5a89f7

Browse files
Make sure GPG-agent does not mess up the TTY (#645)
Co-authored-by: Sindre Sorhus <[email protected]>
1 parent 815d82f commit d5a89f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pure.zsh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,13 @@ prompt_pure_async_git_fetch() {
324324
# Set SSH `BachMode` to disable all interactive SSH password prompting.
325325
export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-"ssh"} -o BatchMode=yes"
326326

327+
# If gpg-agent is set to handle SSH keys for `git fetch`, make
328+
# sure it uses this zpty instead of corrupting the parent TTY.
329+
export GPG_TTY=$TTY
330+
331+
# Tell the child process to not expect any input from this zpty.
332+
exec /dev/null > $TTY
333+
327334
local -a remote
328335
if ((only_upstream)); then
329336
local ref

0 commit comments

Comments
 (0)