修正 Markdown 语法错误。

Signed-off-by: ithink.chan <chenyang@autoai.com>
This commit is contained in:
ithink.chan 2019-07-11 09:35:04 +08:00
parent 2752c74a8f
commit bd5a0a23ea

View File

@ -18,19 +18,25 @@ Gitea 的配置文件为 \<Gitea可执行程序路径\>/custom/conf 目录下的
使用 SC 命令创建 Gitea 服务,并自动运行:
sc create Gitea start= auto binPath= ""<绝对路径>\gitea.exe" web --config "<绝对路径>\custom\conf\app.ini""
C:
```sh
sc create Gitea start= auto binPath= ""<绝对路径>\gitea.exe" web --config "<绝对路径>\custom\conf\app.ini""
```
创建完服务后进入 Windows Services 找到 Gitea 并且点击运行。
如不再需要,同样适用 SC 命令删除服务,删除服务前需先停止该服务。
sc delete Gitea
```sh
sc delete Gitea
```
### Linux 服务
systemd 服务的开启过程如下,首先创建 gitea.service 文件
sudo vim /etc/systemd/system/gitea.service
```sh
sudo vim /etc/systemd/system/gitea.service
```
并参照以下模板填充该文件
@ -71,18 +77,24 @@ WantedBy=multi-user.target
使用如下命令使能并启动 gitea 服务
sudo systemctl enable gitea
sudo systemctl start gitea
```sh
sudo systemctl enable gitea
sudo systemctl start gitea
```
使用如下命令停止 gitea 服务
sudo systemctl stop gitea
```sh
sudo systemctl stop gitea
```
## 使用 HTTPS 服务
可以使用 Gitea 内嵌的 HTTPS 服务。内嵌 HTTPS 服务使用自认证证书,生成 10 年期限自认证证书命令如下:
gitea cert --host [HOST] --duration 87600h
```sh
gitea cert --host [HOST] --duration 87600h
```
编辑 app.ini 文件如下:
@ -97,7 +109,9 @@ KEY_FILE = <绝对路径>/custom/https/key.pem
注意,上面 CERT_FILE 和 KEY_FILE 必须使用绝对路径,否则无法正常启动 Gitea 服务。之后重启 Gitea 服务。通过浏览器访问 HTTPS 版本的 Gitea 服务,需要添加浏览器例外才能正常访问。另外客户端使用 git clone 需要关闭 git 的 ssl 认证功能。命令如下:
git config --global http.sslVerify false
```sh
git config --global http.sslVerify false
```
另外 Gitea 还可以使用 Lets Encrypt 提供的证书,这是 CA 认证证书,有效期为 90 天。Lets Encrypt 的使用方法见官方手册。