frankfurt-laravel
frankfurt-laravel

Reputation: 4131

Heroku PHP with bitbucket-pipelines.yml - git command not found

I spent hours and only found this thread, but the solution didn't help me.

My setup

The problem is, when I push changes to Bitbucket and these are then pushed to Heroku, the git command is not found.

Please see my bitbucket-pipelines.yml in link to pastebin.

When the pipeline step "Deploy to Heroku" runs, it aborts saying

+ git push 
https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD

bash: git: command not found

In the build setup, the installation of git successfully finishes. See screenshot.

Why does the git command afterwards fail?

Thanks in advance!

Upvotes: 2

Views: 1331

Answers (1)

frankfurt-laravel
frankfurt-laravel

Reputation: 4131

Reason for failure was, that in the second step the git components were not installed.

Please find corrected version below.

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.3

pipelines:
default:
- step:
  name: Set up the docker container
  caches:
- composer
  script:
  - apt-get update && apt-get install -y unzip git git-core libc-client-dev libkrb5-dev 
&&   rm -r /var/lib/apt/lists/*
  - docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext- 
install   -j$(nproc) imap
  - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin 
-- filename=composer
- composer install
- vendor/bin/phpunit

- step:
# set HEROKU_API_KEY and HEROKU_APP_NAME environment variables
# set clone `depth: full' as described here: https://confluence.atlassian.com/x/Y9- 
  5Mw
  name: Deploy to Heroku
  deployment: test # set to test, staging or production
# trigger: manual # uncomment to have a manual step
  - apt-get update && apt-get install -y unzip git git-core libc-client-dev libkrb5- 
    dev && rm -r /var/lib/apt/lists/*
  - git push https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD

Upvotes: 1

Related Questions