Skip to content

Commit 82aedae

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (38 commits) Document how the TOC election process works (go-gitea#29135) Runner tokens are multi use (go-gitea#29153) Fix Gitpod logic of setting ROOT_URL (go-gitea#29162) Remove jQuery from the user search form in admin page (go-gitea#29151) Dont load Review if Comment is CommentTypeReviewRequest (go-gitea#28551) Show `View at this point in history` for every commit (go-gitea#29122) [skip ci] Updated translations via Crowdin Add merge style `fast-forward-only` (go-gitea#28954) Use Markdown alert syntax for notes in README (go-gitea#29150) Refactor issue template parsing and fix API endpoint (go-gitea#29069) [skip ci] Updated translations via Crowdin Update some translations and fix markdown formatting (go-gitea#29099) Show more settings for empty repositories (go-gitea#29130) Update JS and PY dependencies (go-gitea#29127) Add alert blocks in markdown (go-gitea#29121) Remove obsolete border-radius on comment content (go-gitea#29128) Make blockquote border size less aggressive (go-gitea#29124) Drop "@" from email sender to avoid spam filters (go-gitea#29109) [skip ci] Updated translations via Crowdin Disallow duplicate storage paths (go-gitea#26484) ...
2 parents f3b61f2 + 4feb91f commit 82aedae

File tree

107 files changed

+1458
-892
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1458
-892
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ rules:
558558
prefer-rest-params: [2]
559559
prefer-spread: [2]
560560
prefer-template: [2]
561-
quotes: [2, single, {avoidEscape: true, allowTemplateLiterals: true}]
562561
radix: [2, as-needed]
563562
regexp/confusing-quantifier: [2]
564563
regexp/control-character-escape: [2]
@@ -811,7 +810,7 @@ rules:
811810
wc/no-constructor-params: [2]
812811
wc/no-constructor: [2]
813812
wc/no-customized-built-in-elements: [2]
814-
wc/no-exports-with-element: [2]
813+
wc/no-exports-with-element: [0]
815814
wc/no-invalid-element-name: [2]
816815
wc/no-invalid-extends: [2]
817816
wc/no-method-prefixed-with-on: [2]

.github/workflows/pull-compliance.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ jobs:
6464
- run: make deps-frontend
6565
- run: make lint-swagger
6666

67+
lint-spell:
68+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.templates == 'true'
69+
needs: files-changed
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: actions/setup-go@v5
74+
with:
75+
go-version-file: go.mod
76+
check-latest: true
77+
- run: make lint-spell
78+
6779
lint-go-windows:
6880
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
6981
needs: files-changed

.gitpod.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ tasks:
1010
- name: Run backend
1111
command: |
1212
gp sync-await setup
13-
if [ ! -f custom/conf/app.ini ]
14-
then
13+
14+
# Get the URL and extract the domain
15+
url=$(gp url 3000)
16+
domain=$(echo $url | awk -F[/:] '{print $4}')
17+
18+
if [ -f custom/conf/app.ini ]; then
19+
sed -i "s|^ROOT_URL =.*|ROOT_URL = ${url}/|" custom/conf/app.ini
20+
sed -i "s|^DOMAIN =.*|DOMAIN = ${domain}|" custom/conf/app.ini
21+
sed -i "s|^SSH_DOMAIN =.*|SSH_DOMAIN = ${domain}|" custom/conf/app.ini
22+
sed -i "s|^NO_REPLY_ADDRESS =.*|SSH_DOMAIN = noreply.${domain}|" custom/conf/app.ini
23+
else
1524
mkdir -p custom/conf/
16-
echo -e "[server]\nROOT_URL=$(gp url 3000)/" > custom/conf/app.ini
25+
echo -e "[server]\nROOT_URL = ${url}/" > custom/conf/app.ini
1726
echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini
1827
fi
1928
export TAGS="sqlite sqlite_unlock_notify"

CONTRIBUTING.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
- [Release Cycle](#release-cycle)
4848
- [Maintainers](#maintainers)
4949
- [Technical Oversight Committee (TOC)](#technical-oversight-committee-toc)
50+
- [TOC election process](#toc-election-process)
5051
- [Current TOC members](#current-toc-members)
5152
- [Previous TOC/owners members](#previous-tocowners-members)
5253
- [Governance Compensation](#governance-compensation)
@@ -486,36 +487,53 @@ if possible provide GPG signed commits.
486487
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
487488
https://help.github.com/articles/signing-commits-with-gpg/
488489

490+
Furthermore, any account with write access (like bots and TOC members) **must** use 2FA.
491+
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
492+
489493
## Technical Oversight Committee (TOC)
490494

491-
At the start of 2023, the `Owners` team was dissolved. Instead, the governance charter proposed a technical oversight committee (TOC) which expands the ownership team of the Gitea project from three elected positions to six positions. Three positions would be elected as it has been over the past years, and the other three would consist of appointed members from the Gitea company.
495+
At the start of 2023, the `Owners` team was dissolved. Instead, the governance charter proposed a technical oversight committee (TOC) which expands the ownership team of the Gitea project from three elected positions to six positions. Three positions are elected as it has been over the past years, and the other three consist of appointed members from the Gitea company.
492496
https://blog.gitea.com/quarterly-23q1/
493497

494-
When the new community members have been elected, the old members will give up ownership to the newly elected members. For security reasons, TOC members or any account with write access (like a bot) must use 2FA.
495-
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
498+
### TOC election process
499+
500+
Any maintainer is eligible to be part of the community TOC if they are not associated with the Gitea company.
501+
A maintainer can either nominate themselves, or can be nominated by other maintainers to be a candidate for the TOC election.
502+
If you are nominated by someone else, you must first accept your nomination before the vote starts to be a candidate.
503+
504+
The TOC is elected for one year, the TOC election happens yearly.
505+
After the announcement of the results of the TOC election, elected members have two weeks time to confirm or refuse the seat.
506+
If an elected member does not answer within this timeframe, they are automatically assumed to refuse the seat.
507+
Refusals result in the person with the next highest vote getting the same choice.
508+
As long as seats are empty in the TOC, members of the previous TOC can fill them until an elected member accepts the seat.
509+
510+
If an elected member that accepts the seat does not have 2FA configured yet, they will be temporarily counted as `answer pending` until they manage to configure 2FA, thus leaving their seat empty for this duration.
496511

497512
### Current TOC members
498513

499-
- 2023-01-01 ~ 2023-12-31 - https://blog.gitea.com/quarterly-23q1/
514+
- 2024-01-01 ~ 2024-12-31
500515
- Company
501516
- [Jason Song](https://gitea.com/wolfogre) <[email protected]>
502517
- [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
503-
- [Matti Ranta](https://gitea.com/techknowlogick) <techknowlogick@gitea.io>
518+
- [Matti Ranta](https://gitea.com/techknowlogick) <techknowlogick@gitea.com>
504519
- Community
505520
- [6543](https://gitea.com/6543) <[email protected]>
506-
- [Andrew Thornton](https://gitea.com/zeripath) <[email protected]>
521+
- [delvh](https://gitea.com/delvh) <[email protected]>
507522
- [John Olheiser](https://gitea.com/jolheiser) <[email protected]>
508523

509524
### Previous TOC/owners members
510525

511526
Here's the history of the owners and the time they served:
512527

513-
- [Lunny Xiao](https://gitea.com/lunny) - 2016, 2017, [2018](https://github.com/go-gitea/gitea/issues/3255), [2019](https://github.com/go-gitea/gitea/issues/5572), [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872)
528+
- [Lunny Xiao](https://gitea.com/lunny) - 2016, 2017, [2018](https://github.com/go-gitea/gitea/issues/3255), [2019](https://github.com/go-gitea/gitea/issues/5572), [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872), 2023
514529
- [Kim Carlbäcker](https://github.com/bkcsoft) - 2016, 2017
515530
- [Thomas Boerger](https://gitea.com/tboerger) - 2016, 2017
516531
- [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) - [2018](https://github.com/go-gitea/gitea/issues/3255), [2019](https://github.com/go-gitea/gitea/issues/5572), [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801)
517-
- [Matti Ranta](https://gitea.com/techknowlogick) - [2019](https://github.com/go-gitea/gitea/issues/5572), [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872)
518-
- [Andrew Thornton](https://gitea.com/zeripath) - [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872)
532+
- [Matti Ranta](https://gitea.com/techknowlogick) - [2019](https://github.com/go-gitea/gitea/issues/5572), [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872), 2023
533+
- [Andrew Thornton](https://gitea.com/zeripath) - [2020](https://github.com/go-gitea/gitea/issues/9230), [2021](https://github.com/go-gitea/gitea/issues/13801), [2022](https://github.com/go-gitea/gitea/issues/17872), 2023
534+
- [6543](https://gitea.com/6543) - 2023
535+
- [John Olheiser](https://gitea.com/jolheiser) - 2023
536+
- [Jason Song](https://gitea.com/wolfogre) - 2023
519537

520538
## Governance Compensation
521539

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-che
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
33-
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.4.1
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
@@ -146,6 +146,8 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
146146
GO_DIRS := build cmd models modules routers services tests
147147
WEB_DIRS := web_src/js web_src/css
148148

149+
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github
150+
149151
GO_SOURCES := $(wildcard *.go)
150152
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
151153
GO_SOURCES += $(GENERATED_GO_DEST)
@@ -219,6 +221,8 @@ help:
219221
@echo " - lint-swagger lint swagger files"
220222
@echo " - lint-templates lint template files"
221223
@echo " - lint-yaml lint yaml files"
224+
@echo " - lint-spell lint spelling"
225+
@echo " - lint-spell-fix lint spelling and fix issues"
222226
@echo " - checks run various consistency checks"
223227
@echo " - checks-frontend check frontend files"
224228
@echo " - checks-backend check backend files"
@@ -308,10 +312,6 @@ fmt-check: fmt
308312
exit 1; \
309313
fi
310314

311-
.PHONY: misspell-check
312-
misspell-check:
313-
go run $(MISSPELL_PACKAGE) -error $(GO_DIRS) $(WEB_DIRS)
314-
315315
.PHONY: $(TAGS_EVIDENCE)
316316
$(TAGS_EVIDENCE):
317317
@mkdir -p $(MAKE_EVIDENCE_DIR)
@@ -351,13 +351,13 @@ checks: checks-frontend checks-backend
351351
checks-frontend: lockfile-check svg-check
352352

353353
.PHONY: checks-backend
354-
checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-validate security-check
354+
checks-backend: tidy-check swagger-check fmt-check swagger-validate security-check
355355

356356
.PHONY: lint
357-
lint: lint-frontend lint-backend
357+
lint: lint-frontend lint-backend lint-spell
358358

359359
.PHONY: lint-fix
360-
lint-fix: lint-frontend-fix lint-backend-fix
360+
lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix
361361

362362
.PHONY: lint-frontend
363363
lint-frontend: lint-js lint-css
@@ -395,6 +395,14 @@ lint-swagger: node_modules
395395
lint-md: node_modules
396396
npx markdownlint docs *.md
397397

398+
.PHONY: lint-spell
399+
lint-spell:
400+
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES)
401+
402+
.PHONY: lint-spell-fix
403+
lint-spell-fix:
404+
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES)
405+
398406
.PHONY: lint-go
399407
lint-go:
400408
$(GO) run $(GOLANGCI_LINT_PACKAGE) run

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ More info: https://docs.gitea.com/installation/install-from-source
9797

9898
./gitea web
9999

100-
NOTE: If you're interested in using our APIs, we have experimental
101-
support with [documentation](https://try.gitea.io/api/swagger).
100+
> [!NOTE]
101+
> If you're interested in using our APIs, we have experimental support with [documentation](https://try.gitea.io/api/swagger).
102102
103103
## Contributing
104104

105105
Expected workflow is: Fork -> Patch -> Push -> Pull Request
106106

107-
NOTES:
108-
109-
1. **YOU MUST READ THE [CONTRIBUTORS GUIDE](CONTRIBUTING.md) BEFORE STARTING TO WORK ON A PULL REQUEST.**
110-
2. If you have found a vulnerability in the project, please write privately to **[email protected]**. Thanks!
107+
> [!NOTE]
108+
>
109+
> 1. **YOU MUST READ THE [CONTRIBUTORS GUIDE](CONTRIBUTING.md) BEFORE STARTING TO WORK ON A PULL REQUEST.**
110+
> 2. If you have found a vulnerability in the project, please write privately to **[email protected]**. Thanks!
111111
112112
## Translating
113113

cmd/serv.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,18 @@ func runServ(c *cli.Context) error {
216216
}
217217
}
218218

219-
// LowerCase and trim the repoPath as that's how they are stored.
220-
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
221-
222219
rr := strings.SplitN(repoPath, "/", 2)
223220
if len(rr) != 2 {
224221
return fail(ctx, "Invalid repository path", "Invalid repository path: %v", repoPath)
225222
}
226223

227-
username := strings.ToLower(rr[0])
228-
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
224+
username := rr[0]
225+
reponame := strings.TrimSuffix(rr[1], ".git")
226+
227+
// LowerCase and trim the repoPath as that's how they are stored.
228+
// This should be done after splitting the repoPath into username and reponame
229+
// so that username and reponame are not affected.
230+
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
229231

230232
if alphaDashDotPattern.MatchString(reponame) {
231233
return fail(ctx, "Invalid repo name", "Invalid repo name: %s", reponame)

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ LEVEL = Info
10441044
;; List of keywords used in Pull Request comments to automatically reopen a related issue
10451045
;REOPEN_KEYWORDS = reopen,reopens,reopened
10461046
;;
1047-
;; Set default merge style for repository creating, valid options: merge, rebase, rebase-merge, squash
1047+
;; Set default merge style for repository creating, valid options: merge, rebase, rebase-merge, squash, fast-forward-only
10481048
;DEFAULT_MERGE_STYLE = merge
10491049
;;
10501050
;; In the default merge message for squash commits include at most this many commits

docs/content/administration/backup-and-restore.zh-cn.md

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ menu:
1919

2020
Gitea 已经实现了 `dump` 命令可以用来备份所有需要的文件到一个zip压缩文件。该压缩文件可以被用来进行数据恢复。
2121

22+
## 备份一致性
23+
24+
为了确保 Gitea 实例的一致性,在备份期间必须关闭它。
25+
26+
Gitea 包括数据库、文件和 Git 仓库,当它被使用时所有这些都会发生变化。例如,当迁移正在进行时,在数据库中创建一个事务,而 Git 仓库正在被复制。如果备份发生在迁移的中间,Git 仓库可能是不完整的,尽管数据库声称它是完整的,因为它是在之后被转储的。避免这种竞争条件的唯一方法是在备份期间停止 Gitea 实例。
27+
2228
## 备份命令 (`dump`)
2329

2430
先转到git用户的权限: `su git`. 再Gitea目录运行 `./gitea dump`。一般会显示类似如下的输出:
@@ -34,15 +40,43 @@ Gitea 已经实现了 `dump` 命令可以用来备份所有需要的文件到一
3440

3541
最后生成的 `gitea-dump-1482906742.zip` 文件将会包含如下内容:
3642

37-
* `custom` - 所有保存在 `custom/` 目录下的配置和自定义的文件。
38-
* `data` - 数据目录下的所有内容不包含使用文件session的文件。该目录包含 `attachments`, `avatars`, `lfs`, `indexers`, 如果使用sqlite 还会包含 sqlite 数据库文件。
43+
* `app.ini` - 如果原先存储在默认的 custom/ 目录之外,则是配置文件的可选副本
44+
* `custom/` - 所有保存在 `custom/` 目录下的配置和自定义的文件。
45+
* `data/` - 数据目录(APP_DATA_PATH),如果使用文件会话,则不包括会话。该目录包括 `attachments``avatars``lfs``indexers`、如果使用 SQLite 则包括 SQLite 文件。
46+
* `repos/` - 仓库目录的完整副本。
3947
* `gitea-db.sql` - 数据库dump出来的 SQL。
40-
* `gitea-repo.zip` - Git仓库压缩文件。
4148
* `log/` - Logs文件,如果用作迁移不是必须的。
4249

4350
中间备份文件将会在临时目录进行创建,如果您要重新指定临时目录,可以用 `--tempdir` 参数,或者用 `TMPDIR` 环境变量。
4451

45-
## Restore Command (`restore`)
52+
## 备份数据库
53+
54+
`gitea dump` 创建的 SQL 转储使用 XORM,Gitea 管理员可能更喜欢使用本地的 MySQL 和 PostgreSQL 转储工具。使用 XORM 转储数据库时仍然存在一些问题,可能会导致在尝试恢复时出现问题。
55+
56+
```sh
57+
# mysql
58+
mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
59+
# postgres
60+
pg_dump -U $USER $DATABASE > gitea-db.sql
61+
```
62+
63+
### 使用Docker (`dump`
64+
65+
在使用 Docker 时,使用 `dump` 命令有一些注意事项。
66+
67+
必须以 `gitea/conf/app.ini` 中指定的 `RUN_USER = <OS_USERNAME>` 执行该命令;并且,为了让备份文件夹的压缩过程能够顺利执行,`docker exec` 命令必须在 `--tempdir` 内部执行。
68+
69+
示例:
70+
71+
```none
72+
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/usr/local/bin/gitea dump -c </path/to/app.ini>'
73+
```
74+
75+
\*注意:`--tempdir` 指的是 Gitea 使用的 Docker 环境的临时目录;如果您没有指定自定义的 `--tempdir`,那么 Gitea 将使用 `/tmp` 或 Docker 容器的 `TMPDIR` 环境变量。对于 `--tempdir`,请相应调整您的 `docker exec` 命令选项。
76+
77+
结果应该是一个文件,存储在指定的 `--tempdir` 中,类似于:`gitea-dump-1482906742.zip`
78+
79+
## 恢复命令 (`restore`)
4680

4781
当前还没有恢复命令,恢复需要人工进行。主要是把文件和数据库进行恢复。
4882

@@ -51,10 +85,10 @@ Gitea 已经实现了 `dump` 命令可以用来备份所有需要的文件到一
5185
```sh
5286
unzip gitea-dump-1610949662.zip
5387
cd gitea-dump-1610949662
54-
mv data/conf/app.ini /etc/gitea/conf/app.ini
88+
mv app.ini /etc/gitea/conf/app.ini
5589
mv data/* /var/lib/gitea/data/
5690
mv log/* /var/lib/gitea/log/
57-
mv repos/* /var/lib/gitea/repositories/
91+
mv repos/* /var/lib/gitea/gitea-repositories/
5892
chown -R gitea:gitea /etc/gitea/conf/app.ini /var/lib/gitea
5993

6094
# mysql
@@ -66,3 +100,55 @@ psql -U $USER -d $DATABASE < gitea-db.sql
66100

67101
service gitea restart
68102
```
103+
104+
如果安装方式发生了变化(例如 二进制 -> Docker),或者 Gitea 安装到了与之前安装不同的目录,则需要重新生成仓库 Git 钩子。
105+
106+
在 Gitea 运行时,并从 Gitea 二进制文件所在的目录执行:`./gitea admin regenerate hooks`
107+
108+
这样可以确保仓库 Git 钩子中的应用程序和配置文件路径与当前安装一致。如果这些路径没有更新,仓库的 `push` 操作将失败。
109+
110+
### 使用 Docker (`restore`)
111+
112+
在基于 Docker 的 Gitea 实例中,也没有恢复命令的支持。恢复过程与前面描述的步骤相同,但路径不同。
113+
114+
示例:
115+
116+
```sh
117+
# 在容器中打开 bash 会话
118+
docker exec --user git -it 2a83b293548e bash
119+
# 在容器内解压您的备份文件
120+
unzip gitea-dump-1610949662.zip
121+
cd gitea-dump-1610949662
122+
# 恢复 Gitea 数据
123+
mv data/* /data/gitea
124+
# 恢复仓库本身
125+
mv repos/* /data/git/gitea-repositories/
126+
# 调整文件权限
127+
chown -R git:git /data
128+
# 重新生成 Git 钩子
129+
/usr/local/bin/gitea -c '/data/gitea/conf/app.ini' admin regenerate hooks
130+
```
131+
132+
Gitea 容器中的默认用户是 `git`(1000:1000)。请用您的 Gitea 容器 ID 或名称替换 `2a83b293548e`
133+
134+
### 使用 Docker-rootless (`restore`)
135+
136+
在 Docker-rootless 容器中的恢复工作流程只是要使用的目录不同:
137+
138+
```sh
139+
# 在容器中打开 bash 会话
140+
docker exec --user git -it 2a83b293548e bash
141+
# 在容器内解压您的备份文件
142+
unzip gitea-dump-1610949662.zip
143+
cd gitea-dump-1610949662
144+
# 恢复 app.ini
145+
mv data/conf/app.ini /etc/gitea/app.ini
146+
# 恢复 Gitea 数据
147+
mv data/* /var/lib/gitea
148+
# 恢复仓库本身
149+
mv repos/* /var/lib/gitea/git/gitea-repositories
150+
# 调整文件权限
151+
chown -R git:git /etc/gitea/app.ini /var/lib/gitea
152+
# 重新生成 Git 钩子
153+
/usr/local/bin/gitea -c '/etc/gitea/app.ini' admin regenerate hooks
154+
```

0 commit comments

Comments
 (0)