From dc48483ad639838a3b17426472497edae28b6e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= Date: Tue, 23 Feb 2010 08:00:47 +0100 Subject: [PATCH] Make magit ask for ssh passphrase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to RĂ¼diger Sonderfeld --- magit.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/magit.el b/magit.el index bfbfe9bc..efd7b575 100644 --- a/magit.el +++ b/magit.el @@ -1074,10 +1074,21 @@ Many Magit faces inherit from this one by default." (magit-set-mode-line-process nil) (magit-refresh-buffer magit-process-client-buffer))) +(defun magit-password (proc string) + "Checks if git/ssh asks for a password and ask the user for it." + (when (string-match "^Enter passphrase for key '\\\(.*\\\)': $" string) + (process-send-string proc + (concat (read-passwd + (format "Password for '%s': " (match-string 1 string)) + nil) "\n")))) + + + (defun magit-process-filter (proc string) (save-current-buffer (set-buffer (process-buffer proc)) (let ((inhibit-read-only t)) + (magit-password proc string) (goto-char (process-mark proc)) ;; Find last ^M in string. If one was found, ignore everything ;; before it and delete the current line.