Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active January 13, 2024 19:20
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save RichardBronosky/429a8fff2687a16959294bcee336dd2a to your computer and use it in GitHub Desktop.
Save RichardBronosky/429a8fff2687a16959294bcee336dd2a to your computer and use it in GitHub Desktop.
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
Copy link

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