Re-import my SSH key password into Keychain for every provisioning & deploy

Hi there,

I’m running my first Trellis based project on a Cloudserver and am loving it!
After merging a second Bedrock based project into my existing Trellis project I’m having some problems with my SSH keys. I’m getting these errors with deploys:

TASK [deploy : Clone project files] ********************************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis 0.9.9: December 14th, 2016
---------------------------------------------------
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

fatal: [109.71.52.199]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}
...ignoring

TASK [deploy : Failed connection to remote repo] *******************************
System info:
  Ansible 2.0.2.0; Darwin
  Trellis 0.9.9: December 14th, 2016
---------------------------------------------------
Git repo git@github.com:MyAccount/trellis.git cannot be accessed. Please
verify the repository exists and you have SSH forwarding set up correctly.
More info:
> https://roots.io/trellis/docs/deploys/#ssh-keys
> https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-
agent-forwarding

Which are quit common errors, I know.

In my ansible.cfg ForwardAgent=yes is configured correctly and I added my Github keys to my users.yml.

I also added a config file in ~/.ssh/ with SSH forwarding for my host:

Host xxx.xx.xx.xxx
  ForwardAgent yes

But only when I run ssh-add -K everytime before deploying the errors disappear? This should be a one-time thing to do right?

Any ideas why I have to re-add them everyday?
Thanks!

So just to be clear, running ssh-add -K solves this problem? (which it should).

You’re just wondering why you need to do this so often?

There’s a ton of results on Google/SO about this:

3 Likes

Yes it does.
Ah ok I see, I didn’t know this was common behaviour.
Thanks!