Git ignores certain Kirby files


I’m new to Kirby and Git and just tried to set up Git for my Kirby installation. Strangely when adding the files to Git it ignored the contents of the following folders, saying something that they were modified/added but not commited:


The folders had .git/ subfolders in them which I moved out of the git folder-tree. But still the problem remains.

The files are not in .gitignore as this listing shows:


But they are also not in the commit:


Can someone tell what’s the problem here?

I would probably trash the .git folder in the root of your project and start over. It’s not unusual for plugins and custom fields to have .git subfolder because some of them are compatible with being used as a git submodule, which allows you to update them directly from git rather then manually.

My usual workflow for setting up a new project and adding git is to do the following:

  • Grab the kirby zip file from the website
  • Add a .gitignore to the root of the project. Tailor this to your needs, but I would suggest adding .DS_Store to it.
  • Intialise it as local git repo.
  • Add the remote to it when you ready to push to github or bitbucket.

On a side note, this path doesn’t seem right:


Should probably be this instead


Hi Jim,

thanks for your response. I have the situation that I have a running website with Kirby which I want to create a central Git repository from to clone to a dev environment and vice versa. I used the following commands (combined from various tutorials):

mkdir myproject.git
cd myproject.git
git init --bare
cd ..
git clone myproject.git temp
mv temp/.git htdocs/
rm -rf temp
cd htdocs
#Add .gitignore
git add .
git status --ignore   # still not showing the mentioned files in either category

I removed .git/ and went over the steps again with no change.

When I try to add the files manually I get the following error:

htdocs/site/fields/tabs$ git add .
git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.

Any suggestions would be much appreciated.

Update: I just came across this post. I did:

htdocs/site/fields$ git rm --cached tabs/
rm 'site/fields/tabs'
htdocs/site/fields$ git add tabs/

but now git status --ignored shows

On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   content/3-termine-und-ausfluege/1-winterlager-2019/lager.txt
        modified:   content/3-termine-und-ausfluege/5-ski-boardtour-auf-die-gehrenspitze/lager.txt
        deleted:    site/fields/tabs
        new file:   site/fields/tabs/
        new file:   site/fields/tabs/assets/css/tabs.css
        new file:   site/fields/tabs/assets/js/tabs.js
        new file:   site/fields/tabs/tabfield.png
        new file:   site/fields/tabs/tabs.php

How do I avoid site/fields/tabs being deleted?

I think the problem is that your cloning one repo into another and its getting mangled, and I really wouldnt put .git in the folder name.

Clone the myproject and delete its .git folder in the root of the folder, move your stuff into it, including the git ignore, THEN initialise it as a repo.

For what its worth, for scaffolding, which is what your doing - ie using a base project as a starting point for others, your better off using tools designed for this like Slush or Yeoman, or roll your own with Corporal.

…or go old school like me and simply copy it to where i want it in finder from a master location. I tend to favour the path of least resistance :slight_smile:

If your really lazy you could probably use Automator that comes with your mac to copy via a service with will let you right click in a folder and dump your files there.

Hi James,

thanks for your elaboration! As it seems, my fix

htdocs/site/fields$ git rm --cached tabs/
rm 'site/fields/tabs'
htdocs/site/fields$ git add tabs/

actually worked (also with the missing files in the other directories) and I was just confused by the way git status listed the file changes :wink: