From:http://toroid.org/ams/git-website-howto
The development project code is stored in the local repository. The following describes how to synchronize a local repository modification to a Web site directory by executing the GIT push Web command.
1. First create a local repository:
mkdir website && in/home/ams/website/.git/echo' Hello, world!. ' >'thehumble beginnings of my web site. "
The local repository contains the relevant code that needs to be synced to the Web site.
2. Remote Repository
Assume that the Web site is built on a remote server. On the remote server, create a mirrored repository:
mkdir website.git &&-- in/home/ams/website.git/
Then, define a post-receive hook file, take advantage of post-receive, detect the latest updates, and synchronize the latest updates to the Web root directory. The contents of the Post-receive file are as follows:
mkdir /var/www/cat > hooks/post-receive#!/bin/shgit_work_tree =/var/www/www.example.org git checkout-chmod +x hooks/post-receive
/var/www/www.example.org: This directory is the Web site root directory
3. Local repository
Add a remote repository path for the local repository and specify the push branch:
ssh://server.example.org/home/ams/website.git$ git push web +master:refs/heads/master
4. To view the remote server Web root directory, you can see the new index.html file.
5. Update operation
In the local repository, execute the following command to update the Web root of the remote server:
git push web
git sync dev Update to project directory (reprint)