== How to Setup Git on server == First thing to do is create a git repo with the command 1. Create a repository in webroot with the command {{{ git init }}} 2. Using a text editor, create a .gitignore file The next thing to note is that you don't want any uploaded files or configuration files to be in the repository in that file (for WordPress sites) add the following lines: {{{ /wp-content/uploads /wp-config.php *~ /.htaccess }}} As a starting point, try the [https://github.com/github/gitignore/blob/master/WordPress.gitignore GitHub .gitignore template]. Can be done by: {{{ echo "/wp-content/uploads }}} click enter Add {{{ /wp-config.php }}} click enter add {{{ " >> .gitignore }}} click enter Also add {{{ echo ".htaccess" >> .gitignore }}} 3. Add files to the git repository with the command {{{ git add . }}} Check status with {{{ git status }}} 4. Do the initial commit with the command {{{ git commit -am"Initial Commit" }}} 5. Create a bare repository outside webroot for example {{{ cd ../include && mkdir code }}} The run {{{ cd code && git init --bare }}} 6. Add a remote to our main git repo with the command {{{ git remote add code ../include/code }}} 7. push our main repo to the remote with the command {{{ git push code master }}} 8. Add needed hooks for handling live and remote changes. A. Using a text editor (nano) with this command 'nano .git/hooks/post-commit.sample' (I think) Use this code {{{ #!/bin/sh echo echo "**** pushing changes to Hub [Prime's post-commit hook]" echo git push code }}} Ctr-x then y to save hit enter The run {{{ mv .git/hooks/post-commit.sample .git/hooks/post-commit }}} B. add post-update hook in the bare repository {{{ nano ../include/code/hooks/post-update.sample }}} Add the following {{{ #!/bin/sh echo echo "**** Pulling changes into Prime [Hub's post-update hook]" echo cd $HOME/cn.glocal.coop/web || exit unset GIT_DIR git pull code master exec git-update-server-info }}} change the file name with the command {{{ mv ../include/code/hooks/post-update.sample ../include/code/hooks/post-update }}} 9. From local web root initialize a git repo with the command {{{ git init }}} A. add a remote to the local repository with the command {{{ git remote add code commnet@rose.mayfirst.org:cn.glocal.coop/include/code }}} B. Pull in the remote repo with the command {{{ git pull code master }}}