mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-11 23:29:09 +08:00
.gitea
.github
assets
build
cmd
contrib
custom
docker
docs
assets
content
doc
advanced
developers
features
help
installation
database-preparation.en-us.md
from-binary.en-us.md
from-binary.fr-fr.md
from-binary.zh-cn.md
from-binary.zh-tw.md
from-package.en-us.md
from-package.fr-fr.md
from-package.zh-cn.md
from-package.zh-tw.md
from-source.en-us.md
from-source.fr-fr.md
from-source.zh-cn.md
from-source.zh-tw.md
on-cloud-provider.en-us.md
on-kubernetes.en-us.md
on-kubernetes.zh-cn.md
on-kubernetes.zh-tw.md
run-as-service-in-ubuntu.en-us.md
run-as-service-in-ubuntu.zh-cn.md
run-as-service-in-ubuntu.zh-tw.md
windows-service.en-us.md
windows-service.fr-fr.md
windows-service.zh-cn.md
windows-service.zh-tw.md
with-docker-rootless.en-us.md
with-docker.en-us.md
with-docker.fr-fr.md
with-docker.zh-cn.md
with-docker.zh-tw.md
packages
secrets
translation
upgrade
usage
advanced.en-us.md
advanced.fr-fr.md
advanced.zh-cn.md
advanced.zh-tw.md
developers.en-us.md
developers.zh-cn.md
developers.zh-tw.md
features.en-us.md
features.zh-cn.md
features.zh-tw.md
help.en-us.md
help.fr-fr.md
help.zh-cn.md
help.zh-tw.md
installation.en-us.md
installation.fr-fr.md
installation.zh-cn.md
installation.zh-tw.md
packages.en-us.md
translation.de-de.md
translation.en-us.md
translation.zh-tw.md
upgrade.en-us.md
upgrade.fr-fr.md
upgrade.zh-cn.md
upgrade.zh-tw.md
usage.en-us.md
usage.zh-cn.md
usage.zh-tw.md
page
layouts
scripts
static
.gitignore
LICENSE
Makefile
README.md
README_ZH.md
config.yaml
models
modules
options
public
routers
services
snap
templates
tests
tools
web_src
.air.toml
.changelog.yml
.dockerignore
.drone.yml
.editorconfig
.eslintrc.yaml
.gitattributes
.gitignore
.gitpod.yml
.golangci.yml
.ignore
.lgtm
.markdownlint.yaml
.npmrc
.spectral.yaml
.stylelintrc.yaml
BSDmakefile
CHANGELOG.md
CONTRIBUTING.md
DCO
Dockerfile
Dockerfile.rootless
LICENSE
MAINTAINERS
Makefile
README.md
README_ZH.md
SECURITY.md
build.go
go.mod
go.sum
main.go
package-lock.json
package.json
playwright.config.js
vitest.config.js
webpack.config.js
56 lines
1.4 KiB
Markdown
56 lines
1.4 KiB
Markdown
---
|
||
date: "2016-12-21T15:00:00-02:00"
|
||
title: "註冊為 Windows 服務"
|
||
slug: "windows-service"
|
||
weight: 10
|
||
toc: false
|
||
draft: false
|
||
menu:
|
||
sidebar:
|
||
parent: "installation"
|
||
name: "Windows 服務"
|
||
weight: 30
|
||
identifier: "windows-service"
|
||
---
|
||
|
||
# 事前準備
|
||
|
||
確認您的 C:\gitea\custom\conf\app.ini 中包含:
|
||
|
||
```
|
||
RUN_USER = COMPUTERNAME$
|
||
```
|
||
|
||
設定 Gitea 以本地使用者身份執行。
|
||
|
||
請將在命令提示字元(cmd)執行 `echo %COMPUTERNAME%` 的結果輸入 `COMPUTERNAME`。若回應為 `USER-PC`,請輸入 `RUN_USER = USER-PC$`
|
||
|
||
## 使用絕對路徑
|
||
|
||
如果您使用 sqlite3,修改 `PATH` 為完整路徑:
|
||
|
||
```
|
||
[database]
|
||
PATH = c:/gitea/data/gitea.db
|
||
```
|
||
|
||
# 註冊為 Windows 服務
|
||
|
||
要註冊為 Windows 服務,請先以系統管理員身份開啟命令提示字元,接著執行下列指令:
|
||
|
||
```
|
||
sc.exe create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"C:\gitea\custom\conf\app.ini\""
|
||
```
|
||
|
||
別忘記將 `C:\gitea` 取代為您的 Gitea 安裝路徑。
|
||
|
||
開啟 Windows 的「服務」,並且搜尋服務名稱「gitea」,按右鍵選擇「啟動」。在瀏覽器打開 `http://localhost:3000` 就可以成功看到畫面 (如果修改過連接埠,請自行修正,3000 是預設值)。
|
||
|
||
## 刪除服務
|
||
|
||
要刪除 Gitea 服務,請用系統管理員身份開啟命令提示字元,接著執行下列指令:
|
||
|
||
```
|
||
sc.exe delete gitea
|
||
```
|