Wordpress Instalation deployed by git isn’t working!

31st January 2019

I’ve recently revamped the website with my own wordpress theme. I deceided to put the whole wordpress instalation into a git repo, which I’m sure will come back to bite me!

When I first deployed it everything looked fine, that was until I tried to create a new post and was greeted by a totally blank page. At first I thought it was a permissions thing as I hadn’t yet set them up to allow wordpress to be able to write to the wp-content folder but then thinking it through that didn’t make any sense as it was trying to write any data to that directory at this stage.

I broke out web developer console and was greeted by a ton of javascript errors. Then I checked the network tab and saw I was getting a few 404 error messages for javascript files in the “wp-includes/js/dist/vendor” folder.

Sure enough, the whole vendor folder hadn’t been uploaded. That’s when it struck me! Composer the PHP package manager tool stores all the packages in a vendor folder at the root of the web application. I always ignore this folder to stop it uploading to my repository and have added it to my global .gitignore file.

When you first add the vendor folder to global ignore in source tree it adds it as just “vendor” this basically means any folder or file with the name “vendor” anywhere in your project is ignored.

To solve this problem just simply go into preferences on SourceTree, click the git tab, at the top click the “Edit File” button next to the Global Ignore List option and then just simply add a slash in front of “vendor” so it instead reads “/vendor”. This will now only ignore the vendor folder in the root of your repo rather than anywhere in it. I commited the newly available files and deployed it, refreshed the page and everything is now working!

Well kind of working… I’ve got to sort out my permissions now!

Discuss on Social Media

Latest Uncategorized Posts