Make magit ask for ssh passphrase
Thanks to Rüdiger Sonderfeld <ruediger@c-plusplus.de>
This commit is contained in:
parent
e70654686c
commit
dc48483ad6
1 changed files with 11 additions and 0 deletions
11
magit.el
11
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.
|
||||
|
|
Loading…
Reference in a new issue