My gitignore file for Yii Framework

Well here it is, my typical .gitignore file for every project. This doesn’t change much. Specially it is written for Yii Framework and CakePHP:

[code lang=”bash”]#Linux

#Revisioning systems

#Mac OS X



#IDEs, compiled languages etc.


#Code Igniter

#Yii Framework


Additionally in the directories ./protected/runtime and ./assets I also added a .gitignore file containing the following:

[code lang=”bash”]*

This allows both folders to be committed into my Git repository despite them being empty. Think of it as CakePHP’s !empty. Both directories will be populated during application run time.

3 thoughts on “My gitignore file for Yii Framework”

  1. Thanks a lot for this post.
    Can you please check if, instead of adding yet another .gitignore file here and there, can’t you simply put:


    Like this, git will not ignore those folders and will push them to the server even if they are empty, but will, however, ignore all files inside those folders.

    What do you think ?

  2. The problem with ignoring folders and never pushing them to the server is that the directories will not be in a repo you clone from the server, and they are needed for Yii to work. I found this out today when I created a repo containing a new project skeleton and cloned it to a different machine. Yii gave me an error message asking “are you sure the webserver has write permission to the xxx directory?” when I tried browsing the new project, but the cause was because the directories didn’t even exist in the cloned project.

Leave a Reply

Your email address will not be published. Required fields are marked *