Gitblit-0x00


最近刚好用到Gitblit来管理源码, 顺手记录一下拆箱过程. (OS: Windows Server 2012 r2)


1. What is Gitblit?

Gitblit 是一个纯 Java 库用来管理, 查看和处理 Git 资料库. 相当于 Git 的 Java 管理工具.

摘自官网的介绍:

Gitblit is an open-source, pure Java stack for managing, viewing, and serving Git repositories.
It’s designed primarily as a tool for small workgroups who want to host centralized repositories.

2. install on windows

  • 安装环境

    • server os : windows server 2012
    • client os : windows 7/ windows 10
    • protocol : http/https
    • client IDE : git bash
  • 分步安装

    • step 0: install Gitblit on windows server 2012

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      // @note this version Gitblit need jdk 1.8+, not support jdk1.6 of my computer
      // STRUCTION(, 及入门级配置参数)
      Gitblit 1.8.0
      - data
      - defaults.properties // default config
      - gitblit.properties // diy config
      - git.repositoriesFolder = F:/other/gitblitServer // git lib 根目录
      - server.httpPort = 65530 // http server port
      - server.httpsPort = 65531 // https server port
      - server.httpBindInterface = // 当需要用外网ip访问时, 置空即可. 初始值为 localhost
      - server.httpsBindInterface = // 置空即可
      - server.certificateAlias = // 置空即可
      - gitblit.cmd // start server bat
      - installService.cmd // install on windows's service
      - uninstallService.cmd // uninstall on windows's service
      // 配置环境的时候, 若执行.cmd不成功, 最好加入`pause`进行问题定位, 跟调.bat脚本一样.
    • step 1: hello world

      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
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
      48
      49
      50
      51
      52
      53
      54
      55
      56
      57
      58
      59
      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      # clone
      Administrator@XXXXX MINGW64 /f/other/SpaceWork
      $ git clone http://hunan@www.qipeiyihao.com:65532/r/test.git
      Cloning into 'test'...
      Checking connectivity... done.
      warning: remote HEAD refers to nonexistent ref, unable to checkout.
      # show current branch
      $ git branch
      * master
      # modify some files
      # push files, occure error
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master)
      $ git push http://hunan@www.qipeiyihao.com:65532/r/test.git master master
      error: dst ref refs/heads/master receives from more than one src.
      error: failed to push some refs to 'http://hunan@www.qipeiyihao.com:65532/r/test.git'
      # push files, 当 远程分支名 === 本地分支名 时, 更正push 命令为:
      # git push 远程分支 本地分支名
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master)
      $ git push http://hunan@www.qipeiyihao.com:65532/r/test.git master
      Counting objects: 3, done.
      Writing objects: 100% (3/3), 234 bytes | 0 bytes/s, done.
      Total 3 (delta 0), reused 0 (delta 0)
      remote: Updating references: 100% (1/1)
      To http://hunan@www.qipeiyihao.com:65532/r/test.git
      d7886f6..2111368 master -> master
      # init mergetool and difftool
      $ git config --global diff.tool bc3
      $ git config --global difftool.bc3.path "C:\Program Files (x86)\Beyond Compare 3\BComp.exe"
      $ git config --global merge.tool bc3
      $ git config --global mergetool.bc3.path "C:\Program Files (x86)\Beyond Compare 3\BComp.exe"
      # git merge use mergetool
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master|MERGING)
      $ git mergetool
      Merging:
      1.txt
      Normal merge conflict for '1.txt':
      {local}: modified file
      {remote}: modified file
      # deal done different modify, add file again, and u must delete tmp file like `YYYY.orig` after deal done different modify
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master|MERGING)
      $ git add 1.txt
      # git add success
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master|MERGING)
      $ git status
      On branch master
      Your branch is ahead of 'origin/master' by 2 commits.
      (use "git push" to publish your local commits)
      All conflicts fixed but you are still merging.
      (use "git commit" to conclude merge)
      Changes to be committed:
      modified: 1.txt
      Untracked files:
      (use "git add <file>..." to include in what will be committed)
      1.txt.orig
      # git commit
      Administrator@XXXXX MINGW64 /f/other/SpaceWork/test (master|MERGING)
      $ git commit -m 'done-merge'
      [master b4621cb] done-merge
    • step 2: Beyond Compare 3 config

      1
      2
      3
      4
      # install path
      C:\Program Files (x86)\Beyond Compare 3\BComp.exe
      # Gitblit path
      F:\other\gitblit-1.8.0\gitblit.cmd

参考资料: