Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Launch ssh-agent on boot (OSX macos)
<plist version="1.0">
<dict>
<key>Label</key>
<string>ssh-add-a</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/ssh-add</string>
<string>-A</string>
</array>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
#!/usr/bin/env bash
# Usage:
# curl -sSL https://gist.github.com/RichardBronosky/429a8fff2687a16959294bcee336dd2a/raw/install.sh | bash
# or:
# wget -qO- https://gist.github.com/RichardBronosky/429a8fff2687a16959294bcee336dd2a/raw/install.sh | bash
dest="$HOME/Library/LaunchAgents/"
url="https://gist.github.com/RichardBronosky/429a8fff2687a16959294bcee336dd2a/raw/AddSSHKeysAtLogin.plist"
mkdir -p "$dest"
cd "$dest"
curl -sLO "$url"
@ephsmith

This comment has been minimized.

Copy link

@ephsmith ephsmith commented May 4, 2018

This is a great example of a login service!

A different approach solved my ssh-agent issues. I added global IdentityFile entries to ~/.ssh/config for each of my keys.

IdentityFile ~/.ssh/git_rsa
IdentityFile ~/.ssh/id_rsa 

Problem solved!

GitHub has also updated their documentation to include similar advice, but I found it necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment