|
| 1 | +title: '快速搭建 Git 服务器[Windows版]' |
| 2 | +author: 少年闰土 |
| 3 | +tags: |
| 4 | + - Git |
| 5 | +categories: |
| 6 | + - Dev |
| 7 | +date: 2020-03-25 13:57:00 |
| 8 | +--- |
| 9 | +## 服务器搭建 |
| 10 | +### 下载 |
| 11 | +* 下载 JDK:[https://www.oracle.com/technetwork/java/javase/downloads/](https://www.oracle.com/technetwork/java/javase/downloads/) |
| 12 | +* 下载 Gitblit:[http://gitblit.com/](http://gitblit.com/) |
| 13 | + |
| 14 | + |
| 15 | +### 解压 |
| 16 | +解压缩下载的压缩包即可,无需安装。 |
| 17 | + |
| 18 | + |
| 19 | +### 创建本地存储文件夹 |
| 20 | + |
| 21 | + |
| 22 | +### 配置 |
| 23 | +打开data文件夹下的`gitblit.properties` |
| 24 | +在第17行可以看到 |
| 25 | +``` |
| 26 | +include = defaults.properties |
| 27 | +``` |
| 28 | +同文件夹下找到`defaults.properties` |
| 29 | +将上边配置的本地存储文件夹的路径复制过来 |
| 30 | +``` |
| 31 | +#git.repositoriesFolder = ${baseFolder}/git |
| 32 | +git.repositoriesFolder = E:\GitBlit\Repository |
| 33 | +``` |
| 34 | +找到server.httpPort,设定http协议的端口号 |
| 35 | +``` |
| 36 | +# Standard http port to serve. <= 0 disables this connector. |
| 37 | +# On Unix/Linux systems, ports < 1024 require root permissions. |
| 38 | +# Recommended value: 80 or 8080 |
| 39 | +# |
| 40 | +# SINCE 0.5.0 |
| 41 | +# RESTART REQUIRED |
| 42 | +server.httpPort = 1024 |
| 43 | +``` |
| 44 | +找到server.httpBindInterface,设定服务器的IP地址。这里就设定你的服务器IP。 |
| 45 | +``` |
| 46 | +# Specify the interface for Jetty to bind the standard connector. |
| 47 | +# You may specify an ip or an empty value to bind to all interfaces. |
| 48 | +# Specifying localhost will result in Gitblit ONLY listening to requests to |
| 49 | +# localhost. |
| 50 | +# |
| 51 | +# SINCE 0.5.0 |
| 52 | +# RESTART REQUIRED |
| 53 | +server.httpBindInterface = localhost |
| 54 | +``` |
| 55 | + |
| 56 | +找到server.httpsBindInterface,设定为localhost |
| 57 | +``` |
| 58 | +# Specify the interface for Jetty to bind the secure connector. |
| 59 | +# You may specify an ip or an empty value to bind to all interfaces. |
| 60 | +# Specifying localhost will result in Gitblit ONLY listening to requests to |
| 61 | +# localhost. |
| 62 | +# |
| 63 | +# SINCE 0.5.0 |
| 64 | +# RESTART REQUIRED |
| 65 | +server.httpsBindInterface = localhost |
| 66 | +``` |
| 67 | + |
| 68 | +### 运行 |
| 69 | +运行gitblit.cmd |
| 70 | + |
| 71 | +如上图则运行成功 |
| 72 | +在浏览器中打开,现在就可以使用GitBlit了。默认用户名密码都是 admin |
| 73 | + |
| 74 | + |
0 commit comments