---
title: 'Deploy to production with git, while installing a theme with composer'
url: 'https://getgrav.org/forum/support/deploy-to-production-with-git-while-installing-a-theme-with-composer-t6289'
markdown: 'https://getgrav.org/forum/support/deploy-to-production-with-git-while-installing-a-theme-with-composer-t6289.md'
date: '2026-06-21'
description: 'I’ve read the page in the docs about git deploy, which suggests to only commit the source user folder of my local dev environment. So far so good. What I’ve'
---

[Support](https://getgrav.org/forum/support)

#  Deploy to production with git, while installing a theme with composer 

 [first-time](https://getgrav.org/forum/tag/first-time) [theme](https://getgrav.org/forum/tag/theme)

  Started by rappluk 1 year ago · 1 replies · 916 views    

 [1 year ago](https://getgrav.org/forum/support/deploy-to-production-with-git-while-installing-a-theme-with-composer-t6289#post-40929 "Permalink") 

I’ve read the page in the docs about git deploy, which suggests to only commit the source `user` folder of my local dev environment. So far so good.

What I’ve done though, is encapsulate my theme in another git repo, and install it to my `user/themes` folder dynamically using composer (either from a local repo clone in root `/packages` or just pull it from github). This is a paradigm I know from some TYPO3 installs I’ve worked on, and it works great for code separation and usability, and ensures I automatically get the right theme on composer install.

This means I would have to commit my `composer.json` and `composer.lock` in the root of the grav installation as well, instead of just the user folder.

How do I best approach that? Also, I noticed that the grav updater overwrites the composer files, so my custom setup there got lost on upgrade.

Any suggestions?

PS: Oh, and I also want to use phpdotenv down the line, which is another thing that I need `composer.json` modified for.

last edited 10/24/25 by rappluk

 [1 year ago](https://getgrav.org/forum/support/deploy-to-production-with-git-while-installing-a-theme-with-composer-t6289#post-40936 "Permalink") 

You can use a `.dependencies` file in the `user` directory of your grav installation to create a manifest of plugins and themes, and run `bin/grav install` to install them. I recently [wrote this into a README](https://github.com/hughbris/grav-theme-receptarr#install-using-dependencies) for a theme I'm redeveloping. Have a look there to save me re-explaining. I did notice an error in the first paragraph where I say the file should go into Grav's root. It should be in Grav `user`.

So:

> Grav's command line interface `install` command will consult a YAML manifest of themes and plugins to install. You'll find Grav's default dependencies in a file called `.dependencies` in Grav's `user` directory.

(I don't think this file is officially documented BTW)

I generally have a few variations between environments (dev, test, prod), so I put the files under `user/env/dev/.gitignore` etc. I symlink `user/.dependencies` in each environment to the right one. (I also symlink `user/env/<hostname>` to `user/env/dev`, `user/env/test` etc. to keep my symlinks consistent.) I commit those environment dependencies. I don't commit the symlink at `user/.dependencies` because it changes per environment. So it's added into my `.gitignore`.

I have recently thought of a better way for me that won't involve setting symlinks in each environment. I haven't implemented this yet. Because I use Docker, I will simply bind mount `user/env/<environment>/.dependencies` to `user/.dependencies`. I use a slightly different standard docker-compose file for each environment anyway. (I actually chain them so that each environment has its own overrides, but that's a detail.) This might seem complicated but it keeps me away from the likes of Kubernetes :) This would only be a viable system if you are using Docker to deploy.

So my deploy becomes just a few steps now:

- `git clone <user dir repo>`
- `docker-compose up -d`
- `bin/grav install`

There are a few config edits and might be a few other steps like running composer for a some plugins that don't come bundled with their PHP dependencies. But it can be as quick as a few minutes, which is fine for how often I do it. Another thing I might do manually is upload files containing secrets that are excluded from my site repos.

A lot more detail than you asked for but it shows that you can come up with a pretty smooth workflow to suit you.

[Log in](https://getgrav.org/login?return=%2Fforum%2Fsupport%2Fdeploy-to-production-with-git-while-installing-a-theme-with-composer-t6289) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [retina images are shown in Admin (but not all of them)](https://getgrav.org/forum/support/retina-images-are-shown-in-admin-but-not-all-of-them-t9504)    [Support](https://getgrav.org/forum/support) · by Anna, 22 hours ago |  | 1 | 31 | [19 hours ago](https://getgrav.org/forum/support/retina-images-are-shown-in-admin-but-not-all-of-them-t9504 "by Anna") |
| [page.date != page.header.date, now my collection sorting is broken (bug? by design?)](https://getgrav.org/forum/support/page-date-page-header-date-now-my-collection-sorting-is-broken-bug-by-design-t9484)    [Support](https://getgrav.org/forum/support) · by Anna, 2 weeks ago |  | 1 | 230 | [2 weeks ago](https://getgrav.org/forum/support/page-date-page-header-date-now-my-collection-sorting-is-broken-bug-by-design-t9484 "by Anna") |
| [it's no possible sign in with email......](https://getgrav.org/forum/support/it-s-no-possible-sign-in-with-email-t9462)    [Support](https://getgrav.org/forum/support) · by webmasterodp, 1 month ago |  | 4 | 361 | [1 month ago](https://getgrav.org/forum/support/it-s-no-possible-sign-in-with-email-t9462 "by webmasterodp") |
| [Site stopped working overnight - 'not writeable' error](https://getgrav.org/forum/support/site-stopped-working-overnight-not-writeable-error-t9445)    [Support](https://getgrav.org/forum/support) · by nwhitfield, 1 month ago |  | 2 | 335 | [1 month ago](https://getgrav.org/forum/support/site-stopped-working-overnight-not-writeable-error-t9445 "by pamtbaau") |
| [MIgrating to 2.0](https://getgrav.org/forum/support/migrating-to-2-0-t9437)    [Support](https://getgrav.org/forum/support) · by stell, 1 month ago |  | 5 | 625 | [1 month ago](https://getgrav.org/forum/support/migrating-to-2-0-t9437 "by stell") |
