skip to navigation
skip to content

Not Logged In

git_deploy 0.3.0dev-20140209

Tool to manage using git as a deployment management tool


It is a tool to manage using git as a deployment management tool implemented in Python and utilizing the dulwich [1]
project for native git functionality in Python.

Git-deploy implements the front end of the deployment system while hooks give the user flexibility in the lower level
details of the deploy. This client uses git to manage the state of your repository and deployment and assumes that on
sync the hooks ensure that the target is made consistent with the client (see default.sync) however, the user is free to
add their own deployment flow and environment options (see examples below).



Basic usage involves cloning the remote working repo to the deploy target and all client nodes. When
a client is ready to deploy 'start' is invoked to obtain a lock on the remote and 'sync' is called to
push changes to the target. On completion the lock is removed.

To start a new deployment, navigate to the working repo, issue a 'start' command:

$ git deploy start [opts]

At this point you are free to make commits to the project and when ready for deployment issue
a 'sync' command - or simply 'sync' if you're work is already complete but, be sure to rebase
your local clone:

$ git deploy sync [opts]

The process may be aborted at any point with an 'abort' command:

$ git deploy abort [opts]

You can rollback to a tag with the revert call:

$ git deploy revert [-t <tag_name>] [opts]

If no tag is supplied the rollback uses the most recent tag. The default is to only commit the rollback locally
however, by suppling the "-a" option for auto-sync the rollback automatically syncs also:

$ git deploy revert [-t <tag_name>] [opts]


The following example illustrates how git-deploy can be configured and used for a single client and target. For this
example the client host and target host will be referred to as ** and ** respectively.
The home path on the client and target for our sample project is */home/me/project/* and */var/www/html/*
respectively. It is assumed that the git remote is configured for your project and for this example the remote alias is
*origin* and the remote branch is *master*.


The client is any working machine from which deployments may be initiated. On ** clone git deploy, local
install, configure settings and initialize:

$ git clone


$ cd git-deploy
$ sudo pip install -e .


Next configure the client instance with git config by assigning the following settings in *scripts/git-deploy.ini*:


Once you have defined settings in *git-deploy.ini* call ** to set the got config

$ sudo ./scripts/init_gd


On ** there is no need to clone and install git-deploy but here the deploy hooks will need to be
created. There is a default hook in *git-deploy/default-hooks/* that should be copied to
** This is a basic hook that will pull the changes
pushed from the client instance on sync.


First initialize a new repository on your client:

$ mkdir
$ cd
$ git init
$ git remote add origin
$ git push origin master

On the target you only need to ensure that *path* in config exists and is configured as a git repo for your project.

*Start* & *Sync*:

Ensure that the client is correctly synced to the remote by issuing a git pull or rebase. Then you can issue a
a start command to write the lock file to the target to begin the deployment.

$ cd
$ touch new_file
$ git add new_file
$ git commit -m "add - my new file"
$ git pull --rebase origin master

At this point you are ready to enter the deployment process: me$ git deploy start

<perform any="" testing="" or="" add="" any="" other="" commits="" as="" necessary="" you've="" locked="" the="" remote="" at="" this="" point=""> me$ git deploy sync

Once you sync a the specified hooks will be invoked from the client and the target and a tag is written to the
repository on the latest commit of the deploy. If the default push and pull hooks are used the client will simply
push its changes to the remote and the target will pull in the new changes. Deployment tags have the form
File Type Py Version Uploaded on Size
git_deploy-0.3.0dev-20140209.tar.gz (md5) Source 2014-02-09 23KB
  • Downloads (All Versions):
  • 2 downloads in the last day
  • 18 downloads in the last week
  • 35 downloads in the last month