markdown 用Git设置WordPress

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 用Git设置WordPress相关的知识,希望对你有一定的参考价值。

#Setup Remote Server
- (taken from http://mikeeverhart.net/git/using-git-to-deploy-code/)
- `mkdir -p /home/cube/gitrepos/displaay.site.git`
- `cd /home/cube/gitrepos/displaay.site.git`
- `git init --bare` - Create a bare (empty) git repository inside of your new directory
- Create a post-receive “hook”. This hook gets executed automatically each time you push code changes to the server. In our case, we’ll use the hook to checkout the latest code from our repository:
  - `nano hooks/post-receive` the paste in:
```
#!/bin/sh 
GIT_WORK_TREE=/home/cube/clients/displaay.com git checkout -f
```
- You can add other shell code to the post-receive hook to do things like chmod files and directories, call other scripts, etc. each time you push updated code to the server.
- `chmod +x hooks/post-receive` - Make your post-receive hook executable
- `mkdir ~/clients/displaay.com`

#Setup local Repository
- (Partially taken from - http://davidwinter.me/articles/2012/04/09/install-and-manage-wordpress-with-git/)
- Create folder in LocalSites `mkdir newsite.com`
- `git init`
- Create Readme file `README.md`
- Initial Commit `git commit -m "Initial commit."`
- Add submodule `git submodule add git://github.com/WordPress/WordPress.git wordpress`
- Checkout latest version `cd wordpress`, `git checkout 3.9.1`
- Add to SourceTree
- Add files & Commit `cd ..`, `git commit -am "Checkout WP 3.9.1`
- Copy Across files to be customised:
```
cp -R wordpress/wp-content ./wp-content
cp wordpress/wp-config-sample.php wp-config.php
cp wordpress/index.php .
```
- Add files & Commit
- Change /index.php
```
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
  changes to
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
```

#Add Remote to dev server
- `cd /LocalSites/project_name`
- Add a remote source that references the server and repository we setup in the previous steps:
```
git remote add production ssh://cube@b2-3b-syd.hosting-services.net.au:2683/home/cube/gitrepos/displaay.site.git
```
- Do an initial push to the remote server, which will setup the master branch. If your branch is named something other than master then use its name in place of master in the following command:
```
git push production +master:refs/heads/master
```
- Also, add the wordpress (or submodule) repo to remote as above, then push the tag after checking it out locally `git push production 3.9.1`

以上是关于markdown 用Git设置WordPress的主要内容,如果未能解决你的问题,请参考以下文章

markdown 使用Git和Subversion镜像进行WordPress插件开发

markdown 用Git设置Magento

markdown 设置PHP CodeSniffer和WordPress标准

markdown 设置一个新的数字海洋 - OpenLiteSpeed Wordpress Droplet

markdown 有关如何在WordPress站点上设置Letsencrypt SSL证书的说明

markdown 为Git设置UTF-8编码