Git Workflow with WordPress - Localhost to Live

前端 未结 3 928
再見小時候
再見小時候 2020-12-24 03:08

I have a basic but common WordPress workflow question.

Current Workflow

  1. I develop everything locally
  2. FTP files (and database
3条回答
  •  星月不相逢
    2020-12-24 03:42

    I'm beginning to set up such a workflow for Wordpress. I already have it working for a few other web projects.

    I'm using the gitolite (https://github.com/sitaramc/gitolite/wiki/) tool for managing bare repositories (repositories without a local checkout) in a central location, then triggering an update hook in gitolite when a branch is pushed from the development location.

    This hook then ssh's to the live server (or client's account or whatever) with a shared private key stored on the deployment server, and does a git pull from the public_html or whatever location you have serving your Wordpress install.

    This is done using a read-only entry in the gitolite config file which is conf/gitolite.conf in the local configuration repository. (Gitolite uses a git repository to manage it's config files)

    repo wp-versions
      RW+ = tmzt
      R = server1
      R = server2
    

    The first is my primary public key, which is stored keydir/tmzt.pub in the same repository (same format as .ssh/authorized_keys). The other two are live web servers which will have read-only access to the repository. Add the three keys to keydir and make sure to commit and push. The changes will be automatically made in the gitolite installation. (The server keys are shared by multiple users and copied to the .ssh/id_rsa file of each user, but this could www-data if you prefer).

    RW+ means my primary user has read, write, and can update non fast-forward branches (useful for reverting commits on the server).

提交回复
热议问题