GIT Group Permission

Posted on October 08, 2011

http://mapopa.blogspot.com/2009/10/git-insufficient-permission-for-adding.html

cd repository.git

sudo chmod -R g+ws *
sudo chgrp -R mygroup *

git repo-config core.sharedRepository true

Git Ignore File Permission

Posted on May 19, 2011


git config core.fileMode false

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.

GIT SVN

Posted on January 22, 2011

git-svn on a bare git repository

http://john.albin.net/git/convert-subversion-to-git

GIT hook pre-commit remove white space

Posted on January 22, 2011

On Mac


#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#

if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# Find files with trailing whitespace
for FILE in `exec git diff-index --check --cached $against -- | sed '/^[+-]/d' | sed -E 's/:[0-9]+:.*//' | uniq` ; do
# Fix them!
sed -i '' -E 's/[[:space:]]*$//' "$FILE"
done

On Linux (Ubuntu)

#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# Find files with trailing whitespace
for FILE in `exec git diff-index --check --cached $against -- | sed '/^[+-]/d' | sed -r 's/:[0-9]+:.*//' | uniq` ; do
# Fix them!
sed -i 's/[[:space:]]*$//' "$FILE"
done