开发者

Publish WordPress Theme via Git

I want to be able to easily push a WordPress theme I am working on to my web server possibly via Git. What software do I need on my Ubuntu server and how do I set up开发者_运维知识库 my Mac to push to that server?


All you need for this is git and ssh. For a better management maybe gitosis. If you need help setting this up, you should have a look at one of the many tutorials out there.

To push the theme into the docroot, there is quit a little more setup:

Create a bare git repository:

mkdir /path/to/my/bare.git
git init --bare /path/to/my/bare.git

Then put a post-receive hook under /path/to/my/bare.git/hooks Use a script like this:

#!/bin/sh
GIT_WORK_TREE=/path/to/my/typo/template git checkout -f

This will checkout the current version of the theme on every push to the server.

EDIT: Using a bare repository and define the work tree on the checkout, has one simple aspect: You wont have any git files in your WordPress installation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜