.gitignore and custom theme

So I just created my own theme with devtools, which works good (the manual way through all kind of errors), but the path is ignored and therefor can not be versioned.

Do I have to add my theme to the .gitignore ? I do not want to work with SFTP Uploads tbh - but rather work with git pulls instead to have a solid pipeline.


@Micha1234, I’m afraid I’m not sure I understand the question…

The Grav zip installation does not come with any .gitignore.

Did you perhaps fork/clone the grav repo instead of downloading the ready-build zip file?

Well yes, it is one of the 3 options in the docs

I understand you want to work with git pulls and not FTP, it’s the best way. But the way you’ve asked, I can’t tell if you want to include or exclude your new theme.

My standard .gitignore has this for my custom themes:




I don’t see the point in versioning below user BTW. Hope that helps.

Ok, thanks. This was not clear to me. Wouldn’t it make sense to have this removed in the Git repo then? I never worked with a Flatfile system, so I am not sure.


I simply added it now and it works

What wasn’t?

What removed?

Added what?

Sorry, it’s really hard to follow what you are saying or asking :confused:

Here’s something that may be the source of your confusion. I thought I mentioned it, but didn’t: your git repo should be initialised under user, not at the site root. You won’t be changing anything outside user. :+1:

Ok, I am kind of confused too. I am used to version the “whole thing” except the dependencies like vendor / node_modules. I am not sure what the benefit is of just versioning the user folder.

If this is the only right way, there is no workaround for uploaded the files if I want to work locally only. Otherwise I will have missing plugins etc.

I might have missed that part in the docs

No problem, we’ll get there if you can be patient :slight_smile: It’s statistically likely we are in different timezones too, to make things more drawn out!

I don’t think there is a right way and I’m not sure which part of the docs you are referring to. I wrote the chapter about deploying using Git and it works well for me.

Here’s my .gitgnore template in the user folder:


You might also ignore user/env but I like to commit that. You could also add ignores for any custom plugins.

The reason I don’t add Grav core files is because it’s not code that I am authoring and I don’t want to have to keep it up to date in the repository. It gets in the way. The only changes to it will be updates. Importantly, Grav is designed so that you never need to edit files outside user.

As for vendor and theme and plugin folders, they are typically excluded. I install and update them manually right now, but there is a way to automate it that I want to start doing. You can keep a manifest file in user (.dependencies I think). Then when you want to install a site’s external dependencies, run bin/grav install from Grav’s root. If I am not mistaken, that will download and install any plugins, themes, and their libraries. I keep a few personal forks of plugins, so the manifest makes using them much simpler. That’s because you can edit the plugin’s URL.

I hope that helps.