本帖根据实践需求,对使用git server的知识进行分类,概述,作为大纲,以后遇到问题可以提高解决效率。具体解决办法会在链接中详述
专业git教程
可以百度git pro,是详细的git教程。
http://www.uml.org.cn/pzgl/201107272.asp
安装与配置
推荐下gitolite,据说配置起来会简便,且这个文档好像挺清楚,还没看
http://www.ossxp.com/doc/git/gitolite.html
安装参考文章:
http://www.cnblogs.com/xl19862005/archive/2011/06/28/2092464.html
本人安装后的总结文章
http://blog.csdn.net/xzongyuan/article/details/9365295
会遇到的错误
安装中会遇到各种错误,我已经总结在该贴:http://blog.csdn.net/xzongyuan/article/details/9332735
1.在安装gitosis时会出错,下载不了gitosis,
使用 git clone https://github.com/res0nat0r/gitosis.git
可以实现clone gitosis包
2.登录服务器
将公钥拷贝到服务器的/tmp下:
usr@pc1:~$ scp .ssh/id_rsa.pub git@<server>:/tmp
具体是指git@<server IP>:/tmp,输入server的IP
3.gitosis clone fatal
如果是直接在linux服务器上git clone,那么要注意路径问题,用绝对路径(好像是版本不同,导致相对路径无效):
git clone git@localhost:/home/git/repositories/gitosis-admin.git
也就是说不能写成网上说的:
git clone git@localhost:gitosis-admin.git
这样写会提示:
1 | fatal: 'gitosis-admin.git' does not appear to be a git repository |
2 | fatal: The remote end hung up unexpectedly |
版本对比
1.提供新版本代码更新的内容
方法:可以用format-patch
format-path可以基于分支进行打包,也可以基于上几次更新内容打包。
基于上几次内容打包
git format-patch HEAD^ 有几个^就会打几个patch,从最近一次打起
git format-patch HEAD^^ 最近的二个patch内容
以下代码作用同上
git format-patch -1
git format-patch -2
git format-patch -1 -4 //可以打包版本2,3的patch。但是发现有时候会把最近4个包都打包出来,具体原因未知。
参考:http://leave001.blog.163.com/blog/static/16269129320126944238969/
关于分支,可以参考:http://www.cnblogs.com/y041039/articles/2411600.html
git错误汇总
http://blog.csdn.net/xzongyuan/article/details/9332735
常用命令
起别名git remote add hh git@server:helloworld.git
http://jiangli.easymorse.com/?p=504
git ssh原理和配置
http://blog.csdn.net/jixiuffff/article/details/5966852
配置后启运服务 /etc/init.d/git-daemon restart
当然也要启动sshd
/etc/init.d/sshd start
无密码登录
http://blog.csdn.net/jixiuffff/article/details/5968929