[GIT] Setup Git Repository (Bare) - fourslickz/notes GitHub Wiki

cd web/live
mkdir project-name.git
cd project-name.git/
git init --bare
cd hooks/
touch post-receive
chmod +x post-receive
vim post-receive

  1. Checking out only a specific branch
#!/bin/sh
GIT_WORK_TREE=/opt/project-name git checkout -f [branch]

  1. Checking out any receiving branch (this is useful for a development setup)
#!/bin/sh
while read oldrev newrev refdo
    branch=´echo $ref | cut -d/ -f3´
GIT_WORK_TREE=/opt/project-name git checkout -f $branch
done.

NOTE:

  • Repo URL for your repository
git remote add [remote-name] ssh://[user]@[site]/~/web/live/project-name.git
git remote add [remote-name] ssh://[user]@[site]:2222/~/web/live/project-name.git