Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh forwarding problem with git in ch06 #2

Open
arglucas opened this issue Jul 14, 2015 · 3 comments
Open

ssh forwarding problem with git in ch06 #2

arglucas opened this issue Jul 14, 2015 · 3 comments

Comments

@arglucas
Copy link

On my OSX 10.10 machine i had a problem with the git step in the mezzanine config. I would get public key denied and with debugging was able to show that agent forwarding was not working. (I had ensured that the ssh-agent was running and that my github key was ssh-add'd to the agent).

Solution for me was to add to the ansible.cfg file so that it looks as follows on the ssh_args line:

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o UserKnownHostsFile=/dev/null

@ryanmaclean
Copy link

I actually had the same problem - thanks!

@doctorwidget
Copy link

I'm having the same problem on OSX 10.10.5, but adding UserKnownHostsFile=dev/null isn't fixing it for me. I haven't modified anything from the provided code, except where explicitly noted below.

For reference, I:

  • am running ansible 1.9.4
  • have confirmed that ssh-agent is running
  • have run ssh-add on my key (with the -K flag for compatibility with the OSX keychain).
  • can see my key listed when I run ssh-add -l
  • get the successful confirmation message from Github when I run ssh -T [email protected].
  • get the same successful message when I run ssh -T [email protected] from inside the VM after connecting to it with vagrant ssh.

However, if I use ansible to ssh in to the VM and try to call Github, the call fails:

$: ansible web -a "ssh -T [email protected]"
web | FAILED | rc=255 >>
Permission denied (publickey).

Which makes the result from the git play not too surprising:

TASK: [check out the repository on the host] ********************************** 
failed: [web] => {"cmd": "/usr/bin/git ls-remote '' -h refs/heads/HEAD", "failed": true, "rc": 128}
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

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

If I'm interpreting this correctly, my agent forwarding is working correctly when done manually through vagrant ssh, but failing from inside ansible. That's despite having my ansible.cfg set up with the ForwardAgent=yes flag. At this point, I'm at something of a loss as to what to try next.

@talaniz
Copy link

talaniz commented Nov 12, 2015

I am still having this issue. I've tried everything from regenerating a new ssh key file to creating and killing several agents. I've learned a lot, but been completely unable to solve it. Here's my latest SO post asking about the issue and covering all the work I've done: http://stackoverflow.com/questions/33656916/ansible-with-github-permission-denied-publickey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants