Bundle exe cap deploy:check fails with git:check

Hi. I’m having trouble with deploying. Whenever I I run

bundle exec cap staging deploy:check

I get this output:

DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
INFO[4e32d66d] Running /usr/bin/env mkdir -p /tmp/<project folder>/ on <server>
DEBUG[4e32d66d] Command: ( WP_ENV=staging /usr/bin/env mkdir -p /tmp/<project folder>/ )
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
INFO[4e32d66d] Finished in 78.265 seconds with exit status 0 (successful).
DEBUGUploading /tmp/senzafine/git-ssh.sh 0.0%
INFOUploading /tmp/senzafine/git-ssh.sh 100.0%
INFO[28a56213] Running /usr/bin/env chmod +x /tmp/<project folder>/git-ssh.sh on <server>
DEBUG[28a56213] Command: ( WP_ENV=staging /usr/bin/env chmod +x /tmp/<project folder>/git-ssh.sh )
INFO[28a56213] Finished in 1.158 seconds with exit status 0 (successful).
DEBUG[34532fbd] Running /usr/bin/env git ls-remote -h git@bitbucket.org:<username>/<repository>.git on <server>
DEBUG[34532fbd] Command: ( WP_ENV=staging GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/<project folder>/git-ssh.sh /usr/bin/env git ls-remote -h git@bitbucket.org:<username>/<repository>.git )
DEBUG[34532fbd]         /usr/bin/env:
DEBUG[34532fbd]         git
DEBUG[34532fbd]         : No such file or directory
DEBUG[34532fbd]
DEBUG[34532fbd] Finished in 1.370 seconds with exit status 127 (failed).
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host <server>: exit

SystemExit: exit

Tasks: TOP => git:check
(See full trace by running task with --trace)

I’m able to login to the server with SSH and run ssh -T git@bitbucket.org and get a successful message, but I can’t deploy. I’m new to Bedrock, so I might be missing something or is it my server’s fault (I’m on a shared host by the way). Thank you!

Capistrano is failing trying to run the git command. Is Git installed on the server?

You can SSH in as your deploy user and try to run that command manually:

/usr/bin/env git ls-remote -h git@bitbucket.org:<username>/<repository>.git

If that does work you might have to set the command map for Git like:

SSHKit.config.command_map[:git] = '/path/to/git'

Thanks for replying!
I added the path to git and it took me one step forward, but unfortunately afterwards I kept getting a permission denied output.
What I did was create a new set of SSH keys (without passphrase this time) and added it to the authorized_keys file on my server and my Bitbucket account, that took me another step forward. Finally I had to upload the SSH keys files to the server and I was able to complete the deploy:check process with one error.
I uploaded my .env file to the shared directory and finished deploy:check successfully.
But when I finally did deploy it threw this at the end:

INFO[8eefff8c] Running /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader on <server>
DEBUG[8eefff8c] Command: cd /<path to directory>/<project>/releases/20150306004452 && ( WP_ENV=staging /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader )
DEBUG[8eefff8c]         /usr/bin/env:
DEBUG[8eefff8c]         composer
DEBUG[8eefff8c]         : No such file or directory
DEBUG[8eefff8c]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host <server>: composer exit status: 127
composer stdout: Nothing written
composer stderr: /usr/bin/env: composer: No such file or directory

SSHKit::Command::Failed: composer exit status: 127
composer stdout: Nothing written
composer stderr: /usr/bin/env: composer: No such file or directory

Tasks: TOP => composer:run
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host <server>: composer exit status: 127
composer stdout: Nothing written
composer stderr: /usr/bin/env: composer: No such file or directory

Maybe I’m being too much of a noobie, but does composer needs to be installed on the server as well? Cause I read that it was necessary only locally.

I tried installing composer on the server with curl -sS https://getcomposer.org/installer | php and php -r "readfile('https://getcomposer.org/installer');" | php and it simply threw an Out of memory message in both instances
I uploaded the composer.phar file directly and tried to run php composer.phar and again the same.
I guess it’s time to change servers.

You could also try increasing the memory limit:

SSHKit.config.command_map[:composer] = 'php -d memory_limit=1G /path/to/composer'

Depends on how much memory the server has.

Well, I got it to work successfully… on a different server. This time I had to specify the path to php 5.4:

SSHKit.config.command_map[:composer] = '/ramdisk/php/54/bin/php54-cli /path/to/composer'

Thank you so much for yor help, this was driving me crazy.

1 Like