Hello guys,
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:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
bash: git: command not found
In the build setup, the installation of git successfully finishes. Screenshot
Why does the git command afterwards fail?
Thanks in advance!
Hey @ffmit,
this is most likely because the git client is not installed in the Docker image that you are using (php:7.1.3).
You can either look for a different image that has git installed, or try installing it (e.g. through `apt-get install git-core` as the first command of your script).
Hello @Jeroen De Raedt,
thanks for your reply, but it is not working, my pipeline is this:
# 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
script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
It still fails with: "+ git push https://heroku:$HEROKU_API_KEY@git.heroku.com/docster-test.git master
bash: git: command not found
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @ffmit,
you installed git in your first step - whereas it is actually needed in your second step.
Try updating your second step to:
- 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
script:
- 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:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jeroen De Raedt,
thanks a thousand times! Indeed, it was the problem that I thought that in the first step I do prepare the whole environment and that in the second step I use it.
Would be great if you could point me (and maybe others) into the right direction at the docs, where this is explained.
Have a nice day, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
each step runs in an seperate docker container so you need to prepare it in the same step as you use it, on the other hand this makes it possible to run different steps with different docker images ^^ this was said in the summit 2016 video on youtube if i remember it rigth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.