"Failed to find required executable git" with deploy

I’ve been playing around with Trellis for the last couple of days. I now have my VM up and running and am up to my first deploy.

In an attempt to deploy to my staging server, i’m getting the following error message:

TASK: [deploy | Clone project files] ****************************************** 
failed: [my.server.ip] => {"failed": true}
msg: Failed to find required executable git

I’m simply using a public git repo while I get my head around all of this, however do I need to firstly create a repo on my staging server also?

Looks like your remote server doesn’t have Git installed? Did you provision it first?

Git is installed by default in Trellis: https://github.com/roots/trellis/blob/737b930be9d1cb03babad2dddb84641d255b8a52/roles/common/tasks/main.yml#L20

So if you never got any errors during provisioning I’m not sure why Git wouldn’t be there.

Did you try to manually SSH into the server as the deploy/web user and run git to see if it exists?

Thanks guys - All i’ve done on the remote server (DO) is add the ubuntu droplet. Is there any further documentation on what I need to do to the droplet?

Yes: https://github.com/roots/trellis#remote-server-setup-stagingproduction

I think i’ve done all of that. Does Ansible create the remote git repo?

You already did that before posting this thread and getting the error? Or you did that since then?

Because if you already provisioned your server according to the README you wouldn’t be getting that error (since it installs Git).

I’m not sure what your exact question is. Does Ansible clone the repository so the code is on the website… or are you asking if Ansible creates the actual project in Git for you?

sorry - i may have all my terminologies mixed up.

I have since installed git on DO. Was there anything more I needed to do on the remote host to ‘provision’?

The error I’m getting now is:

TASK: [deploy | Clone project files] ****************************************** 
failed: [my.ip.address] => {"failed": true}
msg: Failed to checkout master

Do i have to manually commit my bedrock project to github first so that ansible/trellis (whatever is doing the deploying) can clone it to the remote server? This is where I’m a bit confused…

You shouldn’t be installing Git manually.

You’ve run ansible-playbook -i hosts/production server.yml without errors?

I’m so sorry - I’ve just realised that I have missed that step.

I hate wasting your time and I appreciate all your work on this project.

I’m progressing… please bare with me. Next error is this:

TASK: [deploy | Move project subtree into root folder] ************************ 
failed: [my.ip.address] => {"changed": true, "cmd": "mv /srv/www/example.com/releases/20150902031104/site/* /srv/www/example.com/releases/20150902031104", "delta": "0:00:00.006583", "end": "2015-09-02 03:11:37.585163", "rc": 1, "start": "2015-09-02 03:11:37.578580", "warnings": []}
stderr: mv: cannot stat ‘/srv/www/example.com/releases/20150902031104/site/*’: No such file or directory

Thanks again for all your help… can i buy you a beer? :wink:

That means you have the site variable set here: https://github.com/roots/trellis/blob/e1b14de3d566b3a9f2340f25215cf946ac484ad0/group_vars/production/wordpress_sites.yml#L9

If you’re using the site variable than your repo needs to match the folder structure found in our example project here: https://github.com/roots/roots-example-project.com

By that I mean whatever you have site set to should be a top level folder in your repo that contains your WordPress/Bedrock project.

sorted that by commenting the line out - thanks again @swalkinshaw

Got to the ‘Run post_finalize_commands’ and received this error:

changed: [my.ip.address] => (item=if wp core is-installed; then wp eval 'wp_clean_themes_cache(); switch_theme(get_stylesheet());'; fi)
failed: [my.ip.address] => (item=sudo service php5-fpm reload) => {"changed": true, "cmd": "sudo service php5-fpm reload", "delta": "0:00:00.037925", "end": "2015-09-02 14:20:17.236516", "item": "sudo service php5-fpm reload", "rc": 1, "start": "2015-09-02 14:20:17.198591", "warnings": []}
stderr: reload: Unknown instance: 

PLAY RECAP ******************************************************************** 
       to retry, use: --limit @/Users/ryan/deploy.retry

my.ip.address              : ok=18   changed=11   unreachable=0    failed=1

I’m deploying to DO, so there shouldn’t be any sudo user issues?

That’s not a sudo issue.

vagrant@example:~$ sudo service php5-fpm stop
php5-fpm stop/waiting
vagrant@example:~$ sudo service php5-fpm reload
reload: Unknown instance:

It means that for some reason php5-fpm wasn’t previously running. It shouldn’t happen if you never saw any error messages but you can try to manually start it first.

Closing this thread as the initial problem has been solved.