Local Development - Failed to connect to the host via ssh

I’m trying to get Trellis working in a local dev environment and I keep getting the same error. I’ve tried generating new SSH keys, installing different versions of dependencies, and nothing is working.

Failed to connect to the host via ssh.
fatal: [default]: UNREACHABLE! => {"changed": false, "unreachable": true}
	to retry, use: --limit @/Users/Jake M/Websites/working/example.com/trellis/dev.retry

PLAY RECAP *********************************************************************
default                    : ok=0    changed=0    unreachable=1    failed=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

The verbose debug yields this result:

Using /Users/Jake M/Websites/working/example.com/trellis/ansible.cfg as config file
Loaded callback output of type stdout, v2.0

PLAYBOOK: dev.yml **************************************************************
1 plays in dev.yml

PLAY [WordPress Server: Install LEMP Stack with PHP 7.0 and MariaDB MySQL] *****

TASK [setup] *******************************************************************
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o Port=2222 -o 'IdentityFile="/Users/Jake M/Websites/working/example.com/trellis/.vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 -o 'ControlPath=/Users/Jake M/.ansible/cp/ansible-ssh-%h-%p-%r' 127.0.0.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1475906142.78-7299231340079 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1475906142.78-7299231340079 `" )'"'"''
System info:
  Ansible 2.0.2.0; Darwin
  Trellis at "Enable per-site setup for permalink structure"
---------------------------------------------------
Failed to connect to the host via ssh.
fatal: [default]: UNREACHABLE! => {"changed": false, "unreachable": true}
	to retry, use: --limit @dev.retry

PLAY RECAP *********************************************************************
default                    : ok=0    changed=0    unreachable=1    failed=0 

Really hoping someone can help with this. Thanks in advance!

For what it’s worth, the issue was that my home directory contained a space. I renamed my home directory to just be my first name (instead of first and last) and it worked like a charm. Perhaps this is a common issue, but it took me about four days to figure it out, so thought I’d post my solution here!

3 Likes