Преглед на файлове

add check to run ssh-add if identity not loaded

I mentioned we could rely on OS prompts to add identities, but it proved to be
more convenient to just ask at the start of any terminal session, rather than
wait for the first ssh attempt.

Also, this means my tmuxinator setups won't have the chance to ask for the
passphrase.
Weiyi Lou преди 13 години
родител
ревизия
b75862d627
променени са 1 файла, в които са добавени 11 реда и са изтрити 0 реда
  1. 11 0
      zsh/omz-custom/ssh-add.zsh

+ 11 - 0
zsh/omz-custom/ssh-add.zsh

@@ -0,0 +1,11 @@
+# Add the first user identity if the local ssh-agent doesn't already have
+# something.
+#
+# Silence error output for when we're sshing to a machine that we don't want to
+# use ssh-agent forwarding for.
+#
+# This works well when there is only one identity. Don't know what
+# would happen if a person had more than one private key to use.
+if [[ `ssh-add -l 2> /dev/null` != *id_?sa* ]]; then
+  ssh-add 2> /dev/null
+fi