1) Git init in site (old files): $ mkdir www && cd wwww $ echo "1" > old.htm $ git init $ git add . $ git commit -m "first" 2) Git bare repo: $ cd .. $ git clone --bare www/ www.git $ cd www.git/ $ mv hooks/post-update.sample hooks/post-update $ vi hooks/post-update $ less hooks/post-update #!/bin/sh GIT_WORK_TREE=/d/developments/testgit/www git checkout -f $ cd .. $ ls www www.git 3) Clone repo on user1 machine: $ git clone www.git/ user1 $ cd user1/ $ ls old.htm // add new files $ echo "2" > new.htm $ git add . $ git commit -a -m "m" // push to repo $ git remote -v origin d:/developments/testgit/www.git/ (fetch) origin d:/developments/testgit/www.git/ (push) $ git push origin master Counting objects: 4, done. $ cd ../www $ ls new.htm old.htm // new.htm was moved by hooks configuration to www/ 4) Overriding www (common use of FTP) # --- Someone that don't know GIT, used to override with FTP $ cd user1/ $ echo "file to be copy by ftp" > new2.htm $ ls new.htm new2.htm old.htm $ cp * ../www $ cd ../www $ ls new.htm new2.htm old.htm # --- Admin, knows GTI and came after vacation to inspect repos $ cd ../www/ $ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: new.htm # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # new2.htm no changes added to commit (use "git add" and/or "git commit -a") $ cd ../user1/ /user1 $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # new2.htm nothing added to commit but untracked files present (use "git add" to track) # --- Admin repairs repo /user1 $ git add . $ git commit -a -m "restore centeral repo" $ git push origin master $ cd ../www $ git add . $ git remote -v $ git remote add origin /d/developments/testgit/www.git/ $ git push origin master To d:/developments/testgit/www.git/ ! [rejected] master -> master (fetch first) $ git pull origin master $ git status # On branch master nothing to commit, working directory clean -------- Example: * Prod $ cd /z/application/brddpfclients $ git init $ git add . $ git commit -a -m "first" * Bare $ git clone --bare /z/application/brddpfclients/ /z/application/_GIT/app.brddpfclients.git $ cd /z/application/_GIT/app.brddpfclients.git/hooks -- add file (post-update) #!/bin/sh GIT_WORK_TREE=/z/application/brddpfclients git checkout -f * Dev $ cd /y/application/brddpfclients $ git init $ git remote add origin /z/application/_GIT/app.brddpfclients.git/ $ git pull origin master -- modify files $ git add . $ git commit -a -m "m" $ git push origin master