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

Nikita240's avatar

ENVOYER: Is it possible to deploy a repository with submodules?

I've searched but I can't seem to find a solution. My repositories all contain submodules, so it's very important that I can deploy with them.

When I try to run this deployment hook after the clone operation

cd {{release}}

git submodule update --init --recursive

I just get an error

fatal: Not a git repository (or any of the parent directories): .git

Is there any solution for this?

0 likes
6 replies
tekmi's avatar

@Nikita240 Can you describe how you perform your deployment and which tools you use for that?

From my experience, tools like Envoy or Deployer, they usually delete .git folder, therefore you cannot do any other git related operation, once the application got deployed.

However there is always an option to hook into the process of deployment. So if you git clone your main branch/tag, try immediately initialize your git submodules.

tekmi's avatar

@Nikita240 Did you try to add the deployment hooks as specified in this lesson https://laracasts.com/series/envoyer/episodes/4 ?

I would add the hook after the 'Clone New Release`.

Please mind I have never used Envoyer myself, so I hope this video is still valid and beneficial to you.

Personally, I think the deployment tool should be flexible enough to accommodate your needs. You shouldn't be forced to change your preferred way of working because of the tool...especially when it's paid version like Envoyer.

If git submodules are not currently supported there, I would poke Taylor to fix it for you :)

Nikita240's avatar

Yes I did of course add the hook.

From the other threads I've found, it seems to be that git submodules are indeed not supported, which is a problem.

monaye's avatar

Envoyer never clones a repo. It just downloads a zip version of the repo, so the git command will not work.

Just for some other people looking for a starting point. Here is a sample hook you can add after the "Clone New Release" to download the submodule.

// {{release}} is valid variable you can use https://docs.envoyer.io/1.0/projects/deployment-hooks.html#hook-variables
cd {{ release }}/nova-components/  
curl -sLo {{filename}}.tar.gz {{url to zip}}  // make sure to replace {{filename}} and {{url to zip}} with actual value
unzip {{filename}}.tar.gz
rm -rf {{filename}}.tar.gz

Please or to participate in this conversation.