安装脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #!/bin/bash useradd -m git
#安装git-core apt-get install git-core
#创建gitolite安装路径 shell_dir=/ gitolite=/home/git/gitolite mkdir -p $gitolite
#cp key # 安装时替换为管理员秘钥 echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEtBEpIoVQ6ZxFgkQR/Df23lsX+1m5IzKI9VbWDu2KSJhWsuFqc1KGvwYI7DOtcRBUKQFTkf9ExxqbfqUWlyn2cnkpMsfH24Mb28HmHmEBqjtTfurOSH9SNQSgDhxG2K3A0EqiSKFMgFuuGkcyMfIjtTWFhbg5TAWZ69WRnr71QR2pCTuc46bRwRyeZR1s2Ohtss6pF28HphCI58HVg7+VVHTpqz5XLmX6TwOrQtjrTAp0lu12d7Ul5K0IKadF62MOSJJMh0YcC3VZIq1ixqAooUfry+/yS9NBGjJZpKJFeew25tRq9iZJwTp zhangwei@zhangwei' >$gitolite/admin.pub
#cp admin.pub $gitolite
cd $gitolite
git clone git://github.com/sitaramc/gitolite src
echo '开始安装gitolite ......'
${gitolite}/src/install -to $gitolite
echo "安装到了$gitolite"
rm -rf ${gitolite}/src
chown -R git:git $gitolite
#将管理员key放到同级目录命名为admin.pub 并启动 su - git -c "${gitolite}/gitolite setup -pk ${gitolite}/admin.pub "
|
安装钩子
gitolite 钩子目录为 /home/git/.gitolite/hooks/common
钩子脚本拷贝到这个目录,比如post-receive。
执行以下脚本刷新钩子
1 2
| /home/git/gitolite/gitolite setup --hooks-only
|