Windows下配置Git服务器和客户端

转自:http://www.cnblogs.com/lwme/archive/2012/12/25/configuring-git-server-and-client-on-windows.html

scm-manager

Gitblit

为了配合Redmine使用,特地用Git来做版本控制。

选择Git服务器部署策略

找了一圈,发现如下方法来架设Git服务器:

  1. Git Candy:http://github.com/Aimeast/GitCandy/ AE大神的作品, Git Candy© 是一个基于ASP.NET MVC的Git分布式版本控制平台,Git Candy的目标是轻松干掉Bonobo,逐渐追赶Github,并用微创新超过Github
  2. Bonobo Git Server:http://www.chodounsky.net/bonobo-git-server/ 需要IIS6+/.net 4/asp.net MVC 3,官方提供了比较详细的安装说明,但据说问题不少
  3. WebGit.NET:https://github.com/otac0n/WebGitNet/wiki/Getting-Started 需要IIS/asp.net MVC 3/msysgit,好久不更新了
  4. Git-Web-Access:https://github.com/yysun/Git-Web-Access 又一个MVC开发的,也好久没有更新
  5. git-dot-aspx:https://github.com/JeremySkinner/git-dot-aspx 需要iis7+/.net 4/asp.net MVC 2,也好久没有更新
  6. Grack:https://github.com/schacon/grack  需要ror环境,也好久没有更新
  7. GitStack:http://gitstack.com/ 对系统的要求比较高,2003/xp就无法支持了
  8. scm-manager:https://bitbucket.org/sdorra/scm-manager 需要Java环境,更新比较频繁,安装配置比较简单
  9. Gitblit:http://gitblit.com/ 同样需要Java环境,安装配置比较简单
  10. Gitalist:http://www.gitalist.com/ 需要perl环境,安装配置也简单
  11. Indefero:http://www.indefero.net/open-source/ 需要PHP/MySQL/Apache等,好久不更新
  12. Git Daemon即守护进程:通过git daemon --reuseaddr --base-path=/path/to/git/启动,通过git://协议进行访问,使用9418端口进行通信,需要配合Gitosis才能好用
  13. Gitolite:https://github.com/sitaramc/gitolite 需要cygwin/ssh以及一堆设置
    1. http://therightstuff.de/CommentView,guid,b969ea4d-8d2c-42af-9806-de3631f4df68.aspx
    2. http://beta.wikiversity.org/wiki/Topic:Git/%E5%9C%A8Windows%E4%B8%8B%E5%AE%89%E8%A3%85Gitolite
  14. gitosis:https://github.com/tv42/gitosis 需要cygwin/ssh以及一堆设置
    1. http://markembling.info/2009/08/git-server-gitosis-and-cygwin-on-windows
    2. http://jerabi.com/sdionne/blog/2010/09/06/git-repository-server-gitosis-on-win7-working/
  15. GitLab:http://gitlabhq.com/ 需要ruby/Gitolite/Nginx等一堆
  16. CopSSH+msysgit+putty等工具,配置好繁琐
    1. http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP
    2. http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/
    3. http://www.codeproject.com/Articles/296398/Step-by-Step-Setup-Git-Server-on-Windows-with-CopS
  17. 通过GitHub.com,或者类似的托管服务,这个是最省事的了
  18. Windows文件共享,但是不利于权限控制,极不推荐
    1. git remote add origin file:///ipaddress/sharename/
    2. git clone file:///ipaddress/sharename/

通过比较发现需要CopSSH/Cygwin等环境的应用配置起来比较复杂,剩下的几个支持git smart http协议的web应用配置起来比较简单:

  1. Bonobo Git Server
  2. WebGit.NET
  3. Git-Web-Access
  4. scm-manager
  5. Gitblit
  6. Gitalist

最后再根据更新/稳定等因素筛选出Bonobo Git Server、scm-manager、Gitblit,结果最终选择了scm-manager。

配置scm-manager

在机器上安装java环境,从http://java.com/zh_CN/download/manual.jsp选择脱机版下载安装

https://bitbucket.org/sdorra/scm-manager/wiki/download下载最新的scm-server-1.24-app.zip

安装为系统服务:

1
scm-server.bat install

然后在系统服务里设置为自动启动,然后启动服务就可以通过http://localhost:8080访问了,默认用户名和密码都是scmadmin。

登进系统以后通过Repository Types修改Git中心库存放的路径。

修改默认的管理员用户名或者是其他的一些配置都可以找到%userprofile%\.scm\config目录下的相应xml配置文件来修改,注意要重启scm-server服务。

更新:低版本操作系统如server 2003可能会在C:\Documents and Settings\Default User\.scm这样的目录下,而不是当前用户文件夹

如果要启用邮件以及提醒,还需要安装插件scm-mail-plugin、 scm-notify-plugin,然后在设置中把Mail相关的SMTP设置填写好。

如果代码提交要跟Redmine关联,还需要安装插件scm-redmine-plugin,然后在项目信息里的Redmine选项卡配置Redmine地址为http://localhost:3000

如果要启用更新、自动关闭,还需要scm-manager和redmine使用同样的用户名密码,而且Redmine设置里必须启用REST API;

然后在提交的时候需要用git commit –m “(#问题ID) fix 修复内容”来关闭问题,可以用的关键字如fix,fixed等可以自行配置。

客户端安装

不管最终是使用那一种客户端(Git Extensions:http://code.google.com/p/gitextensions/或TortoiseGit:http://code.google.com/p/tortoisegit/),msysgit都是必须安装的:从http://msysgit.github.com/下载最新的Git-1.8.0-preview20121022.exe安装即可。

偏向使用命令行的只装msysgit就足够了;如果要使用图形界面可以选择msysgit自带的git gui,或者是另外安装git extensions或tortoisegit;个人感觉git extensions的图形界面比较强大,如果安装它的话一定要安装上KDiff3。

更便捷的就是与Visual Studio集成了,Git Extensions安装的时候可以选择安装Visual Studio插件集成;另外还有一个工具可以进一步提升便捷性Git Source Control Provider:http://gitscc.codeplex.com/,它依赖于msysgit和git extensions,可以在官方网站下载安装或者在visual studio扩展管理里面搜索git进行安装。

Git配置

Git客户端安装好之后最好配置一个全局的用户名及邮箱:

1
2
git config --global user.name "Your Name Here"
git config --global user.email your_email@youremail.com

这个配置在新建Repository时可能会用到;另外可以通过一下命令来查看配置:

1
git config --list

Git相关资料

  1. Pro Git 中文版:http://git-scm.com/book/zh http://progit.org/book/zh/ 有墙,用google随便找一个PDF版直接下载
  2. Git Community Book 中文版:http://gitbook.liuhui998.com/index.html
  3. Git Magic:http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/zh_cn/
  4. Git开发管理之道:http://blog.leezhong.com/translate/2010/10/30/a-successful-git-branch.html
  5. 如何高效利用GitHub:http://www.yangzhiping.com/tech/github.html
  6. 图解Git:http://marklodato.github.com/visual-git-guide/index-zh-cn.html
  7. 笔记《版本控制之道--使用Git》:http://www.nshen.net/sitelog/2011/08/03/git-note.html
  8. Git 故事连载:http://gitstory.wordpress.com/category/git/ Git Web Access作者写的(注意有墙)

另外还可以从Git Immersion一步一步演练:http://gitimmersion.com/lab_01.html

 

------EOF-----




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值