美文网首页
Windows平台使用Gitblit搭建Git服务器

Windows平台使用Gitblit搭建Git服务器

作者: GuangHui | 来源:发表于2018-03-20 19:22 被阅读83次
    一. 安装java

    下载地址:http://www.java.com/zh_CN/
    如果不会安装,请自行百度过程.

    二. 配置java环境变量

    右键”计算机” => ”属性” => ”高级系统设置” => ”高级” => “环境变量” => “系统变量”。

    1. 新建:变量名:JAVA_HOME
      变量值:C:\Program Files\Java\jre1.8【具体要根据你自己的安装路径】
    2. 新建变量名:CLASSPATH
      变量值:%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar
    3. 添加
      找到PATH变量,选择编辑。把%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin添加到”变量值”的结尾处。
    三. 搭建Gitblit服务器
    1. 下载地址:http://gitblit.com/
    2. 解压缩下载的压缩包即可,无需安装。我的保存位置为D:\develop\GitServer\gitblit-1.8.0
    3. 创建一个目录,用来存放代码库D:\develop\GitServer\gitdata
    4. 修改data目录下的gitblit.properties D:\develop\GitServer\gitblit-1.8.0\data\gitblit.properties
      可以从同目录下defaults.properties文件中拷贝过来的,追加上内容之下,并进行如下内容部分的修改:
    # Base folder for repositories.
    # This folder may contain bare and non-bare repositories but Gitblit will only
    # allow you to push to bare repositories.
    # Use forward slashes even on Windows!!
    # e.g. c:/gitrepos
    #
    # SINCE 0.5.0
    # RESTART REQUIRED
    # BASEFOLDER
    #修改代码库存放路径
    git.repositoriesFolder = D:\develop\GitServer\gitdata
    
    # Standard http port to serve.  <= 0 disables this connector.
    # On Unix/Linux systems, ports < 1024 require root permissions.
    # Recommended value: 80 or 8080
    #
    # SINCE 0.5.0
    # RESTART REQUIRED
    #设定http协议端口号
    server.httpPort = 10101
    
    # Secure/SSL https port to serve. <= 0 disables this connector.
    # On Unix/Linux systems, ports < 1024 require root permissions.
    # Recommended value: 443 or 8443
    #
    # SINCE 0.5.0
    # RESTART REQUIRED
    #设定https协议端口号
    server.httpsPort = 8443
    
    # Specify the interface for Jetty to bind the standard connector.
    # You may specify an ip or an empty value to bind to all interfaces.
    # Specifying localhost will result in Gitblit ONLY listening to requests to
    # localhost.
    #
    # SINCE 0.5.0
    # RESTART REQUIRED
    #设定服务器的ip地址,本地搭建,这里要写自己本地的ip地址
    server.httpBindInterface =10.52.22.124
    
    # Specify the interface for Jetty to bind the secure connector.
    # You may specify an ip or an empty value to bind to all interfaces.
    # Specifying localhost will result in Gitblit ONLY listening to requests to
    # localhost.
    #
    # SINCE 0.5.0
    # RESTART REQUIRED
    server.httpsBindInterface =localhost
    
    1. 修改installService.cmd D:\develop\GitServer\gitblit-1.8.0\installService.cmd
    @REM arch = x86, amd64, or ia32
    SET ARCH=x86
    

    32位系统:SET ARCH=x86
    64位系统:SET ARCH=amd64
    我的电脑是64位的,我照样选择的x86,没有问题,你可以适当调整设置.

    1. 以Windows Service方式启动Gitblit.
      说明:启动过程中,如果不成功,可以查看D:\develop\GitServer\gitblit-1.8.0\logs中的日志文件,查看日志信息,根据日志定位问题.

    (1) 鼠标右击Gitblit目录下的installService.cmd文件,以管理员身份运行。
    (2) 鼠标右击Gitblit目录下的gitblitw.exe文件,以管理员身份运行.
    运行之前,建议做如下图的设置变更:


    成功启动后的效果如下图:


    (3) 检查windows服务,搜索services.msc

    如果未启动的话,也可以在这里手动启动.注意确保为自动模式,每次windows启动都自动启动
    四. 登录
    1. 浏览器访问:http://10.52.22.124:10101 依据gitblit.properties中的配置
      成功
    2. 用管理员账号登陆 用户名/密码 admin/admin
    五. 参考文章
    1. Window系统下搭建GIT本地服务器
    2. Windows平台下搭建Git服务器的图文教程
    3. Windows平台使用Gitblit搭建Git服务器及使用

    相关文章

      网友评论

          本文标题:Windows平台使用Gitblit搭建Git服务器

          本文链接:https://www.haomeiwen.com/subject/uqnbqftx.html