To show the used port on Mac

Posted on February 09, 2011

sudo lsof -i :8080

GIT Hook Post Push

Posted on February 03, 2011

This is a practice of http://toroid.org/ams/git-website-howto

1. create a bared repo

mkdir /git/website.git
cd /git/website.git
git init --bare

#create a deploy folder for the site
mkdir /git/www

# to set hook to checkout the latest code into /git/www
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/git/www git checkout -f
chmod +x hooks/post-receive

2. create a repo

mkdir /git/website
cd /git/website
# init repo
git init

echo 'Hello, world!' > index.html
git add index.html && git commit -m 'init'

# define the mirror and add master to it
git remote add web /git/website.git
git push web +master:refs/heads/master

# turn off the receive.denyCurrentBranch
git config --bool receive.denyCurrentBranch false

cat > .git/hooks/post-receive
#!/bin/sh
git push web +master:refs/heads/master

3. clone repo

cd /git
git clone /git/website dev
cd dev

echo 'a new file' > new.html
git add new.html && git commit -m 'add new file'
git push

Note, I have not tested it with ssh.