Created
June 18, 2014 15:56
-
-
Save electrum/5e335e346e12b046f103 to your computer and use it in GitHub Desktop.
Add SSH certificate and keys to agent from Mac OS X keychain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
FILE="$HOME/.ssh/id_rsa" | |
NAME="SSH: $FILE" | |
PASSWORD=$(security find-generic-password -w -l "$NAME") | |
expect << EOF | |
spawn ssh-add $FILE | |
expect "Enter passphrase" | |
send "$PASSWORD\r" | |
expect eof | |
EOF | |
ssh-add -A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment