Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.25 KB

deploy.rst

File metadata and controls

42 lines (29 loc) · 1.25 KB

Git for site deployment

On the remote:

$ mkdir website.git && cd website.git
$ git init --bare
Initialized empty Git repository in /home/user/website.git/

pair:hook; post-receive

Define a post-receive hook:

$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout --force
$ chmod +x hooks/post-receive

On the main site define a remote:

$ git remote add web ssh://server.example.org/home/user/website.git
$ git config remote.web.push "+master:refs/heads/master"
$ git push web

Reference: Using Git to manage a web site by Abhijit Menon-Sen

Ian Bicking does not like this strategy and prefer to:

copy the working directory to a new location (minus .git/), commit that, and push the result to your deployment remote. You can send modified and untracked files, and you can run a build script before committing and push the result of the build script, all without sullying your "real" source control.

-- Ian Bicking in this blog

He writed git-sync automating this task