Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

neuralnet's avatar

Can't use Git in Deployment Hooks?

I made a custom deployment hook in Envoyer and I want to use Git to get the latest tag (which is the version). But this hook doesn't work, why can't I use Git in a deployment hook and how can I fix this?

I tried doing:

cd {{ release }} GIT_VERSION_TAG=$(git describe --tags 2>/dev/null)

0 likes
3 replies
chiefguru's avatar
Level 8

Hi @neuralnet Envoyer doesn't deploy your package as a GIT repository, so there is nothing there to describe.

neuralnet's avatar

Damn okay I thought so. Going to have to read it from a file or something then

dpslwk's avatar

I use the following in an envoyer deploy script to write a the branch and commit sha to a file

echo -n "{{ branch }}-" > {{release}}/version
echo -n {{ sha }} | awk '{print substr(LARACASTS_SNIPPET_PLACEHOLDER,0,7)}' >> {{release}}/version

Please or to participate in this conversation.