git-deploy: Git plugin to enable one-touch deployment. There are many others like it, but this one is mine. INSTALLATION $ ./install Or, to install site-wide: $ sudo ./install USAGE 1) Push to a bare repo somewhere - GitHub, perhaps. 2) Set up passwordless ssh login on the host you intend to deploy to. 3) git-clone your GitHub repo on the deployment host. 4) Deploy your code: $ git deploy The first time you invoke git-deploy, you will be prompted for the host and directory to deploy to. 6) Oh no! You've discovered a bug in production that your extensive automated test suite didn't catch! You need to revert to the last deployed version NOW NOW NOW! Never fear: $ git undeploy DISCUSSION Only a fool would attempt to deploy a site by pushing to a non-bare repo. This script doesn't do that. Instead, it assumes you have three repos: 1) A development repo, probably on your local box. 2) A central bare repo on a hosting site or company VCS server. 3) A deployment repo, from which your code actually runs. git-deploy, when run in (1), will push to (2), ssh to (3) and then pull from (2) to (3). If you need to change the deployment host or directory, edit the git configuration variables deploy.host and deploy.dir with git config. For interactive use, git config -e is a convenient way of setting variables. git-undeploy simply checks out the last visited snapshot on the deployment repo, and resets the "master" branch to point at that snapshot. To fix the bug and redeploy, you must either alter the master branch on the hosting repo too, or you must make your fixed snapshot a child of the one that you deployed (possibly by using git merge -s ours). Repeated git-undeploy's will not remove successive deployments. Only the most recent deployment will be reverted. FIXMES It may be a very bad idea to combine pushing and deployment like this. Then again, maybe it's a great idea. I have yet to find out. The initial checkout on the deployment repo could be done automatically. Maybe I could provide support for multiple deployment hosts. Would anyone use this? Possibly in cluster scenarios? AUTHOR Copyright 2011 Miles Gould. This code is free software: see the file COPYING for details.
pozorvlak/git-deploy
Script for one-touch deployment of code in git repos. There are many others like it, but this one is mine.
GPL-3.0