# SSH-Agent Forwarding Errors (ssh-add)

**URL:** https://discourse.roots.io/t/ssh-agent-forwarding-errors-ssh-add/6266
**Category:** trellis
**Created:** 2016-03-22T07:24:01Z
**Posts:** 1

## Post 1 by @masoninthesis — 2016-03-22T07:24:02Z

Last week I started a thread [Best Practice: Password Authentication](https://discourse.roots.io/t/best-practice-passwordless-authentication/6230). One of my blunders was solved in the thread, but I believe my underlying issue had to do with [this excerpt found in Github’s docs](https://developer.github.com/guides/using-ssh-agent-forwarding/#troubleshooting-ssh-agent-forwarding): (as @fullyint suggested)

> On Mac OS X, ssh-agent will “forget” this key, once it gets restarted during reboots. But you can import your SSH keys into Keychain using this command:  
> `ssh-add -K`

When I did that I would get the error:

`ssh-add: illegal option -- K`

With an output of:

```
usage: ssh-add [options] [file ...]
Options:
  -l List fingerprints of all identities.
  -E hash Specify hash algorithm used for fingerprints.
  -L List public key parameters of all identities.
  -k Load only keys and not certificates.
  -c Require confirmation to sign using identities
  -t life Set lifetime (in seconds) when adding identities.
  -d Delete identity.
  -D Delete all identities.
  -x Lock agent.
  -X Unlock agent.
  -s pkcs11 Add keys from PKCS#11 provider.
  -e pkcs11 Remove keys provided by PKCS#11 provider.
```

At first I was assuming the capital letter K in the command was a typo and was replacing it for a lower case ‘k’.

But upon further problems deploying I realized it was an entirely different command.

The solution was in [this blog post on rotating ssh keys](http://jasonmorris.com/til/rotating-ssh-keys/). I’m pretty sure the issue had to do with my current version of OSX Yosemite on my macbook (10.10.2).

If you ever get the error “ssh-add: illegal option – K” try this:

Specify the path to the correct version of “ssh-add”, run:`/usr/bin/ssh-add -K ~/.ssh/id_rsa`

That did the trick. Just wanted to document this better because it took me a little while to locate.  
Thanks for your help @fullyint and @swalkinshaw
