svn hook 快速同步 配置

REPOS=”$1″
REV=”$2″
export LANG=”zh_CN.UTF-8″
export LC_CTYPE=”zh_CN.UTF-8″
for updatePath in `/usr/bin/svnlook changed -r $REV $REPOS | awk ‘{print $2}’`
do
  fullUpdatePath=”/var/www/$updatePath”
  /usr/bin/svn update –username hook –password hookpassword $fullUpdatePath >> /var/www/logs/svn_rain_update.log
  chmod g+w $fullUpdatePath
done

CentOS安装Git服务器 Centos 6.4 + Git 1.8.2.2 + gitosis (笔记)

http://www.cnblogs.com/vicowong/archive/2013/05/06/3062397.html

 

 

1.显示服务器版本
cat /etc/redhat-release
#CentOS release 6.4 (Final)

ipconfig
#服务器IP192.168.1.225 域名www.domain.com  SSH端口8200(默认为22)

2.安装git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel

#下载git-1.8.2.2.tar.gz 到 /usr/local/src 下载网址http://code.google.com/p/git-core

cd /usr/local/src
tar -zvxf git-1.8.2.2.tar.gz
cd git-1.8.2.2

make prefix=/usr/local/git all
make prefix=/usr/local/git install

#增加软连接
ln -s /usr/local/git/bin/* /usr/bin/

git –version
#如何能显示版本号,即表示成功

3.安装gitosis
yum install python python-setuptools

cd /usr/local/src
git clone git://github.com/res0nat0r/gitosis.git
cd gitosis
python setup.py install

#显示Finished processing dependencies for gitosis==0.2即表示成功

4.在开发机上,生产密钥并上传到服务器上

ssh-keygen -t rsa
#一路回车,不需要设置密码

#上传公钥到服务器(默认SSH端口22)
#scp ~/.ssh/id_rsa.pub root@192.168.1.225:/tmp

#scp ~/.ssh/id_rsa.pub root@www.domain.com:/tmp/

#如修改SSH端口(端口8200)
#git clone ssh://git@192.168.1.225:8200/gitosis-admin.git

#git clone ssh://git@www.domain.com:8200/gitosis-admin.git

#修改配置文件,可以省略每次输入端口
vim ~/.ssh/config
#修改客户端~/.ssh/config文件,添加以下代码
host www.domain.com
hostname www.domain.com
port 8200

#修改后,客户端即可用以下方式进行连接
#git clone ssh://git@www.domain.com/gitosis-admin.git

#上传公钥到服务器(修改端口,并在配置中指定端口)
scp ~/.ssh/id_rsa.pub root@www.domain.com:/tmp/

ls /tmp/id_rsa.pub
#显示已经上传的密钥

5.服务器上生成git用户,使用git用户并初始化gitosis
adduser -m git

su – git

gitosis-init < /tmp/id_rsa.pub

#显示以上信息即表示成功
#Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
#Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/

#删除密钥
su – root
rm -rf /tmp/id_rsa.pub

6.在开发机上导出管理
mkdir -p /repo
cd /repo
git clone git@www.domain.com:gitosis-admin.git

7.增加及设置管理项目
cd /repo/gitosis-admin

#查看已经上传密钥
ls keydir
cat keydir/vicowong\@VICO.pub  #vicowong@VICO.pub为已经上传的开发机生成的公密

#显示密钥最后的符串为密钥用户名 这里为vicowong@VICO

vim gitosis.conf

#在文件尾增加以下内容
[group test-git] # 组名称
writable = test-git # 项目名称
members = vicowong@VICO #密钥用户名

#提交修改
git add .
git commit -a -m “add test-git repo”
git push

9.初始,增加及使用项目test-git
cd /repo
mkdir test-git
cd test-git
git inti
touch readme
git add .
git commit -a -m “init test-git”
git remote add origin git@www.domain.com:test-git.git
git push origin master

CentOS5.7 编译安装 Git 配置Git仓库

总结:不加路径可直接使用命令添加操作
ln -s /usr/local/bin/git* .
ln -s /usr/sbin/svn* .
加【.】表示排除文件夹目录

[root@localhost repository]# git clone root@74.207.254.10:/usr/local/system/repository/blog
Initialized empty Git repository in /root/repository/blog/.git/
bash: git-upload-pack: command not found #竟然报这么个错误,这是怎么回事呢?
fatal: The remote end hung up unexpectedly

通过google得知,git-upload-pack这个命令的path为:/usr/local/git/bin/ ,他不在non-login shell 路径下(/usr/bin),下面是解决办法:

# Fix it with symlinks in /usr/bin
[root@li96-10 ~]# cd /usr/bin/
[root@li96-10 bin]# ln -s /usr/local/git/bin/git* .

 

问题:git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

http://vsfor.com/archives/114

find the file,then copy the path to /etc/ld.so.conf   and save it

then $/sbin/ldconfig

ok   that’s it

安装git之后出现 某些库无法加载的情况,找到该库文件所在位置,将其路径添加至 /etc/ld.so.conf  文件中

保存后运行 /sbin/ldconfig即可