84 Commits
Author SHA1 Message Date
recoolcz 43ad642ef2 bugfix (3d viewer): fixed a typo that prevented the script from working (#227)
Reviewed-on: https://gitea.com/gitea/docs/pulls/227
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: recoolcz <[email protected]>
Co-committed-by: recoolcz <[email protected]>
2025-06-03 18:16:12 +00:00
Renovate Bot 753dbfb4aa fix(deps): update dependency redocusaurus to v2.5.0 (#226)
Reviewed-on: https://gitea.com/gitea/docs/pulls/226
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-06-01 00:25:13 +00:00
Schallbert 5d9094adb0 Clarify customization's folder structure when using non-standard install like docker (#219)
customizing: add backlink to install for variations
install-with-docker: add example for customization
Reviewed-on: https://gitea.com/gitea/docs/pulls/219
Co-authored-by: Schallbert <[email protected]>
Co-committed-by: Schallbert <[email protected]>
2025-05-26 16:11:47 +00:00
Renovate Bot 7ec1b19826 fix(deps): update dependency redocusaurus to v2.3.0 (#223)
Reviewed-on: https://gitea.com/gitea/docs/pulls/223
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-05-26 16:11:03 +00:00
dmitri.karpovich f58dfff5e4 Update docs/usage/actions/quickstart.md (#222)
Fix typo

Reviewed-on: https://gitea.com/gitea/docs/pulls/222
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: dmitri.karpovich <[email protected]>
Co-committed-by: dmitri.karpovich <[email protected]>
2025-05-26 00:07:58 +00:00
Renovate Bot 5bf02bcd9c fix(deps): update dependency @mui/material to v7.1.0 (#221)
Reviewed-on: https://gitea.com/gitea/docs/pulls/221
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-05-15 16:28:02 +00:00
Lunny Xiao e1ed1a6280 Upgrade Gitea from 1.23.7 -> 1.23.8 2025-05-13 09:51:20 -07:00
Lunny Xiao 6e63ddb901 Add 1.24.0-rc0 documentation (#220)
Reviewed-on: https://gitea.com/gitea/docs/pulls/220
2025-05-05 16:47:20 +00:00
Kerwin BryantandLunny Xiao e1500d23c7 Optimize the 404 page (#216)
Fix 404 party of #213

<img width="1386" alt="2743f73507eb76ce0b749e9d804e34c.png" src="attachments/7dbeeab8-6e31-405e-8dc8-917e4a843657">

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/216
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: Kerwin Bryant <[email protected]>
Co-committed-by: Kerwin Bryant <[email protected]>
2025-04-30 18:40:22 +00:00
techknowlogick 2a39f74205 add oidc introspection endpoint to list (#217)
Reviewed-on: https://gitea.com/gitea/docs/pulls/217
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-committed-by: techknowlogick <[email protected]>
2025-04-28 03:48:45 +00:00
Lunny Xiao 1d51bc6814 Update token scopes example (#215)
Reviewed-on: https://gitea.com/gitea/docs/pulls/215
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-04-26 04:27:13 +00:00
Lunny Xiao eed3454a8a Update token scopes example (#214)
Reviewed-on: https://gitea.com/gitea/docs/pulls/214
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-04-26 04:21:26 +00:00
wxiaoguang 14d48e6834 Update PUBLIC_URL_DETECTION (#212)
https://github.com/go-gitea/gitea/pull/34250
Reviewed-on: https://gitea.com/gitea/docs/pulls/212
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-committed-by: wxiaoguang <[email protected]>
2025-04-21 23:10:45 +00:00
Rowan BohdeandLunny Xiao c299483551 Add documentation for request prioritization middleware (#208)
This is the documentation side of https://github.com/go-gitea/gitea/pull/33951

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/208
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: Rowan Bohde <[email protected]>
Co-committed-by: Rowan Bohde <[email protected]>
2025-04-20 23:41:58 +00:00
wxiaoguang f29075ebeb Update ROOT_URL document (#210)
Reviewed-on: https://gitea.com/gitea/docs/pulls/210
Reviewed-by: hiifong <[email protected]>
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-committed-by: wxiaoguang <[email protected]>
2025-04-20 23:35:21 +00:00
bytedream df3f3f8dab Action badge style query (#209)
Add dcos for the new style query for action badges (https://github.com/go-gitea/gitea/pull/34062).

Reviewed-on: https://gitea.com/gitea/docs/pulls/209
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: bytedream <[email protected]>
Co-committed-by: bytedream <[email protected]>
2025-04-13 17:54:09 +00:00
jukeandJules Kerssemakers 1a85ffdab8 Expand new Usage/Markdown Docu (#203)
As promised in [Gitea Pull #34105](https://github.com/go-gitea/gitea/pull/34105), I wanted to contribute documentation for MarkDown.

You were so fast in adding the page that I had to start over my local-only draft 😄 🚀

I'm not sure how you prefer your commits (I'm new to Gitea), so I've split them for simplest review and dropping of unwanted changes.

Co-authored-by: Jules Kerssemakers <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/203
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: juke <[email protected]>
Co-committed-by: juke <[email protected]>
2025-04-10 20:15:37 +00:00
Renovate Bot ac2186b6fb fix(deps): update dependency redocusaurus to v2.2.3 (#205)
Reviewed-on: https://gitea.com/gitea/docs/pulls/205
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-04-10 18:25:53 +00:00
Renovate Bot b2b64a0401 fix(deps): update dependency @mui/material to v7.0.2 (#204)
Reviewed-on: https://gitea.com/gitea/docs/pulls/204
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-04-10 18:25:46 +00:00
Kerwin Bryant d5945b5091 add og:image/logo meta (#206)
Reviewed-on: https://gitea.com/gitea/docs/pulls/206
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Kerwin Bryant <[email protected]>
Co-committed-by: Kerwin Bryant <[email protected]>
2025-04-10 01:51:07 +00:00
wxiaoguang cc53afc60e Update MERMAID_MAX_SOURCE_CHARACTERS (#202)
Reviewed-on: https://gitea.com/gitea/docs/pulls/202
2025-04-09 07:58:18 +00:00
recoolczandLunny Xiao 330f8b808b CAD File Preview - Last Change (markup, spelling, script) (#201)
Fixed all remaining issues (spelling mistakes, markup, etc.)

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/201
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: recoolcz <[email protected]>
Co-committed-by: recoolcz <[email protected]>
2025-04-08 15:13:15 +00:00
recoolczandLunny Xiao a6305438b9 Fix CAD Files Preview section (#200)
CAD Preview section is broken on live website (bad markup usage). Hopefully fixed it :D
Thanks a lot

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/200
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: recoolcz <[email protected]>
Co-committed-by: recoolcz <[email protected]>
2025-04-08 06:48:11 +00:00
Lunny Xiao ae186bfdcc Update to 1.23.7 2025-04-07 15:41:45 -07:00
recoolczandLunny Xiao 718d024fe9 Change STL preview to CAD file preview (#199)
Based on [this Issue on GitHub]([url](https://github.com/go-gitea/gitea/issues/34135)) I created a pull request.

This implementation allows for all other kinds CAD files to be previewed in Gitea.

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/199
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: recoolcz <[email protected]>
Co-committed-by: recoolcz <[email protected]>
2025-04-07 18:50:51 +00:00
wxiaoguang e3d58503ca Add markdown usage (#198)
First simple version

Reviewed-on: https://gitea.com/gitea/docs/pulls/198
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-committed-by: wxiaoguang <[email protected]>
2025-04-05 05:08:06 +00:00
Bo-Yi Wu (吳柏毅) 802aeb1e0c docs: update zh-tw (#197)
Signed-off-by: appleboy <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/197
Reviewed-by: Lunny Xiao <[email protected]>
2025-04-05 01:51:55 +00:00
Lunny Xiao abc5be48cc Fix language selection 2025-04-04 18:45:25 -07:00
appleboy ac801c4790 docs: update zh-tw (#197)
Signed-off-by: appleboy <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/197
Co-authored-by: appleboy <[email protected]>
Co-committed-by: appleboy <[email protected]>
2025-04-05 00:57:20 +00:00
appleboy dbfa0ba454 docs: add zh-tw folder (#195)
Signed-off-by: appleboy <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/195
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: appleboy <[email protected]>
Co-committed-by: appleboy <[email protected]>
2025-04-04 23:28:16 +00:00
Renovate Bot 3275094871 fix(deps): update dependency @easyops-cn/docusaurus-search-local to v0.49.2 (#192)
Reviewed-on: https://gitea.com/gitea/docs/pulls/192
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-04-01 21:04:49 +00:00
Renovate Bot 10e315d235 fix(deps): update dependency @mui/material to v7.0.1 (#193)
Reviewed-on: https://gitea.com/gitea/docs/pulls/193
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-04-01 21:04:28 +00:00
ManInDarkandtechknowlogick bec3fc4398 SSH multiple IPs (#194)
Added documentation for alternative ssh setup if multiple IPs are available.

Co-authored-by: techknowlogick <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/194
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: ManInDark <[email protected]>
Co-committed-by: ManInDark <[email protected]>
2025-04-01 20:31:35 +00:00
Renovate Bot 10c3198134 fix(deps): update dependency @mui/material to v7 (#189)
Reviewed-on: https://gitea.com/gitea/docs/pulls/189
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-31 15:43:57 +00:00
Renovate Bot aedc957200 fix(deps): update react monorepo to v19.1.0 (#190)
Reviewed-on: https://gitea.com/gitea/docs/pulls/190
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-31 15:43:20 +00:00
wxiaoguang d432fb57ac Update config option: REQUIRE_SIGNIN_VIEW (#191)
Reviewed-on: https://gitea.com/gitea/docs/pulls/191
2025-03-30 05:37:25 +00:00
yp05327 2757101442 doc: ENABLE_PASSKEY_AUTHENTICATION (#187)
fix: https://github.com/go-gitea/gitea/issues/34021
Reviewed-on: https://gitea.com/gitea/docs/pulls/187
Reviewed-by: wxiaoguang <[email protected]>
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: yp05327 <[email protected]>
Co-committed-by: yp05327 <[email protected]>
2025-03-26 14:43:41 +00:00
Lunny Xiao ba60733fd9 upgrade to gitea 1.23.6 2025-03-24 14:53:49 -07:00
Renovate Bot 8d3a6af0de fix(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.49.0 (#184)
Reviewed-on: https://gitea.com/gitea/docs/pulls/184
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-24 04:39:54 +00:00
Renovate Bot 3c69e687b4 fix(deps): update dependency @mui/material to v6.4.8 (#185)
Reviewed-on: https://gitea.com/gitea/docs/pulls/185
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-24 02:17:12 +00:00
Renovate Bot 4809b3d4c8 fix(deps): update dependency redocusaurus to v2.2.2 (#186)
Reviewed-on: https://gitea.com/gitea/docs/pulls/186
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-24 02:16:59 +00:00
techknowlogick 714b9dd6b7 fix launchctl example
thanks for #183 that reported and fixed this issue in versioned docs
2025-03-14 02:14:01 +00:00
BenoitDuffez 1a8c4f0836 fix typo in LaunchAgent sample (#183)
the typo makes the file invalid and launchctl refuses to start with very little details as to why

Reviewed-on: https://gitea.com/gitea/docs/pulls/183
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: BenoitDuffez <[email protected]>
Co-committed-by: BenoitDuffez <[email protected]>
2025-03-13 22:00:07 +00:00
wxiaoguangandLunny Xiao 2b1f9ff532 Add FILE_ICON_THEME (#181)
Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/181
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-committed-by: wxiaoguang <[email protected]>
2025-03-10 21:25:11 +00:00
wxiaoguang a64bf5f8e3 Update custom theme guide (#180)
For https://github.com/go-gitea/gitea/pull/30671

Reviewed-on: https://gitea.com/gitea/docs/pulls/180
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-committed-by: wxiaoguang <[email protected]>
2025-03-10 15:55:10 +00:00
Renovate Bot 4cacad97aa fix(deps): update dependency @mui/material to v6.4.7 (#178)
Reviewed-on: https://gitea.com/gitea/docs/pulls/178
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-03-07 03:29:13 +00:00
3f023b3b62 fix/get-tokens-example (#179)
Users reported issues at https://github.com/go-gitea/gitea/issues/28820

Co-authored-by: Stephan Kristyn <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/179
Reviewed-by: Lunny Xiao <[email protected]>
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: wethinkagile <[email protected]>
Co-committed-by: wethinkagile <[email protected]>
2025-03-07 03:28:59 +00:00
Felix Sommer 8c7577a67c EMBED_ATTACHMENT_IMAGES: Docs for PR https://github.com/go-gitea/gitea/pull/32061 (#69)
Co-authored-by: Felix Sommer <[email protected]>
Co-committed-by: Felix Sommer <[email protected]>
2025-03-05 16:14:07 +00:00
Lunny Xiao 41bc13f04f Release of Gitea 1.23.5 (#177)
Reviewed-on: https://gitea.com/gitea/docs/pulls/177
2025-03-05 01:28:46 +00:00
TheFox0x7 eaeb29f827 Add warning about actions under subpath (#176)
in reference to: https://github.com/go-gitea/gitea/issues/33629

Reviewed-on: https://gitea.com/gitea/docs/pulls/176
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: TheFox0x7 <[email protected]>
Co-committed-by: TheFox0x7 <[email protected]>
2025-03-02 17:52:04 +00:00
Renovate Bot 003bc73398 fix(deps): update dependency @mui/material to v6.4.6 (#171)
Reviewed-on: https://gitea.com/gitea/docs/pulls/171
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-02-28 15:38:57 +00:00
techknowlogick 52933671d8 use docker.gitea.com docker URLs (#175)
Reviewed-on: https://gitea.com/gitea/docs/pulls/175
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
Co-committed-by: techknowlogick <[email protected]>
2025-02-28 15:36:37 +00:00
Lunny Xiao 045ad3fd8c Add missing cron items content (#174)
Reviewed-on: https://gitea.com/gitea/docs/pulls/174
2025-02-25 20:13:15 +00:00
b-nagaj 540072fa39 FIX: DB Prep Docs - Step #1 (#173)
## Description

Fix step 1 of the [Database Preparation](https://docs.gitea.com/installation/database-prep) docs.

## Changes

When a user modifies the */etc/mysql/my.cnf* config file as instructed in step 1 of the database preparation guide, they get an error message from MySQL when trying to log in as the root user after saving changes.

```shell
mysql: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 37.
mysql: [ERROR] Fatal error in defaults handling. Program aborted!
```
The solution is to include precede `bind-address` with a group like this.

```ini
[mysqld]
bind-address = 203.0.113.3
```

Reviewed-on: https://gitea.com/gitea/docs/pulls/173
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: b-nagaj <[email protected]>
Co-committed-by: b-nagaj <[email protected]>
2025-02-25 19:39:31 +00:00
Lunny Xiao ed742f54da Fix ci 2025-02-19 15:40:23 -08:00
Lunny Xiao 235e1199d8 Fix ci 2025-02-19 15:37:15 -08:00
Lunny Xiao 674911fecd Fix ci 2025-02-19 11:56:34 -08:00
Lunny Xiao bc2618cea3 Fix ci 2025-02-19 11:37:23 -08:00
Lunny Xiao 88ff15b0f5 Fix ci 2025-02-19 11:30:35 -08:00
Lunny Xiao 04b38c7f3a Fix ci 2025-02-19 11:26:48 -08:00
Lunny Xiao bb149ae308 upgrade to 1.23.4 2025-02-19 11:05:44 -08:00
Renovate Bot a7d3ff1ea1 fix(deps): update dependency @easyops-cn/docusaurus-search-local to v0.48.5 (#169)
Reviewed-on: https://gitea.com/gitea/docs/pulls/169
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-02-16 17:47:17 +00:00
Renovate Bot eb0c2f7ccc fix(deps): update dependency @mui/material to v6.4.4 (#165)
Reviewed-on: https://gitea.com/gitea/docs/pulls/165
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-02-16 17:46:36 +00:00
Lunny Xiao 452b13ec63 upgrade to 1.23.3 (#168)
Reviewed-on: https://gitea.com/gitea/docs/pulls/168
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-02-06 19:34:36 +00:00
Lunny Xiao cea3a053b7 upgrade to 1.23.2 (#166)
Reviewed-on: https://gitea.com/gitea/docs/pulls/166
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-02-05 21:50:46 +00:00
Renovate Bot 93d5d77bfd fix(deps): update dependency @mui/material to v6.4.2 (#161)
Reviewed-on: https://gitea.com/gitea/docs/pulls/161
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-31 16:58:53 +00:00
Renovate Bot 6ebfe37c28 fix(deps): update dependency @easyops-cn/docusaurus-search-local to v0.48.4 (#157)
Reviewed-on: https://gitea.com/gitea/docs/pulls/157
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-31 16:58:48 +00:00
Lunny Xiao bbbb9091bf Update act runner status (#163)
Fix #162

Reviewed-on: https://gitea.com/gitea/docs/pulls/163
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-01-29 05:12:05 +00:00
Brandon Philips 59ef598b49 fix admin url for 1.23.0 (#164)
I am running the release candidate and found the admin URL changed.
https://github.com/go-gitea/gitea/pull/32189

Reviewed-on: https://gitea.com/gitea/docs/pulls/164
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Brandon Philips <[email protected]>
Co-committed-by: Brandon Philips <[email protected]>
2025-01-28 16:33:32 +00:00
strathmeyer e5057c6a83 Correct verb tense in index.md (#159)
Reviewed-on: https://gitea.com/gitea/docs/pulls/159
Reviewed-by: KN4CK3R <[email protected]>
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: strathmeyer <[email protected]>
Co-committed-by: strathmeyer <[email protected]>
2025-01-18 20:01:46 +00:00
99rgosse b84e09cd7b Add the "--skip-index" parameter for dump command (#158)
Hello
This PR is only to show up the "--skip-index" parameter missing from the documentation from the "dump" command

Reference in code : https://github.com/go-gitea/gitea/blob/main/cmd/dump.go#L267

Reviewed-on: https://gitea.com/gitea/docs/pulls/158
Co-authored-by: 99rgosse <[email protected]>
Co-committed-by: 99rgosse <[email protected]>
2025-01-17 17:43:21 +00:00
Lunny Xiao b5245578b5 Fix API 404 (#156)
Fix #154

Reviewed-on: https://gitea.com/gitea/docs/pulls/156
2025-01-16 07:01:43 +00:00
woshishabii 56cbea7928 a typo i guess (#155)
Reviewed-on: https://gitea.com/gitea/docs/pulls/155
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: woshishabii <[email protected]>
Co-committed-by: woshishabii <[email protected]>
2025-01-16 00:16:26 +00:00
Renovate Bot 9acb2b3eb7 fix(deps): update dependency redocusaurus to v2.2.1 (#151)
Reviewed-on: https://gitea.com/gitea/docs/pulls/151
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-14 17:21:55 +00:00
Renovate Bot 93b1d04dab fix(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.48.0 (#152)
Reviewed-on: https://gitea.com/gitea/docs/pulls/152
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-14 17:21:48 +00:00
Renovate Bot aeb506659c fix(deps): update dependency @mui/material to v6.4.0 (#153)
Reviewed-on: https://gitea.com/gitea/docs/pulls/153
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-14 17:21:34 +00:00
yp05327 192a773da3 Fix update swagger json (#150)
I can not understand the old logic:
- download the web page (not the raw data) from GitHub
- replace `AppVer`
- remove the file???

It does nothing.

The correct logic:
- download the raw file from GitHub
- replace `AppVer` and `AppSubUrl`
- move the file to the correct place

As the script is not correct for a long time, added the support for all version since 1.19.

Fix #142

Reviewed-on: https://gitea.com/gitea/docs/pulls/150
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: yp05327 <[email protected]>
Co-committed-by: yp05327 <[email protected]>
2025-01-14 03:00:44 +00:00
TheFox0x7 301154989a Add docusaurus faster (#149)
Leads to about half the build time.

Reviewed-on: https://gitea.com/gitea/docs/pulls/149
Co-authored-by: TheFox0x7 <[email protected]>
Co-committed-by: TheFox0x7 <[email protected]>
2025-01-10 19:15:45 +00:00
Lunny Xiao 1ddf6a1822 upgrade to 1.23.1 (#148)
Reviewed-on: https://gitea.com/gitea/docs/pulls/148
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2025-01-10 18:58:33 +00:00
Renovate Bot a9fdbab409 fix(deps): update react monorepo to v19 (major) (#121)
Reviewed-on: https://gitea.com/gitea/docs/pulls/121
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-10 18:11:48 +00:00
Renovate Bot e05a89ff18 fix(deps): update dependency redocusaurus to v2.2.0 (#117)
Reviewed-on: https://gitea.com/gitea/docs/pulls/117
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-10 17:53:57 +00:00
Renovate Bot 3c21d98474 fix(deps): update docusaurus monorepo to v3.7.0 (#118)
Reviewed-on: https://gitea.com/gitea/docs/pulls/118
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-10 16:20:11 +00:00
Renovate Bot 4c47d3b921 fix(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.47.0 (#140)
Reviewed-on: https://gitea.com/gitea/docs/pulls/140
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
2025-01-10 16:08:26 +00:00
Lunny Xiao 67e83400bd update version to 1.23.0 (#141)
Reviewed-on: https://gitea.com/gitea/docs/pulls/141
2025-01-10 05:28:14 +00:00
1181 changed files with 170250 additions and 5690 deletions

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ on:
jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@@ -21,7 +21,7 @@ jobs:
pip install awscli
- name: prepare awesome list
run: |
make prepare-awesome-latest prepare-awesome\#22 prepare-awesome\#21 prepare-awesome\#20 prepare-awesome\#19
make prepare-awesome-latest prepare-awesome\#23 prepare-awesome\#22 prepare-awesome\#21 prepare-awesome\#20 prepare-awesome\#19
- name: Cache ~/.npm for npm ci
uses: actions/cache@v4
with:
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
cache: npm
- name: prepare awesome list
run: |
make prepare-awesome-latest prepare-awesome\#22 prepare-awesome\#21 prepare-awesome\#20 prepare-awesome\#19
make prepare-awesome-latest prepare-awesome\#23 prepare-awesome\#22 prepare-awesome\#21 prepare-awesome\#20 prepare-awesome\#19
- name: Cache ~/.npm for npm ci
uses: actions/cache@v4
with:
+14 -6
View File
@@ -11,13 +11,21 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: |
wget https://github.com/go-gitea/gitea/blob/main/templates/swagger/v1_json.tmpl
sed -i "$@" 's/"version": "{{AppVer | JSEscape | Safe}}"/"version": "dev"/' static/swagger-latest.json
rm v1_json.tmpl
wget https://raw.githubusercontent.com/go-gitea/gitea/refs/heads/main/templates/swagger/v1_json.tmpl
sed -i "$@" 's\"version": "{{AppVer | JSEscape}}"\"version": "dev"\' v1_json.tmpl
sed -i "$@" 's\"basePath": "{{AppSubUrl | JSEscape}}/api/v1"\"basePath": "https://gitea.com/api/v1"\' v1_json.tmpl
mv v1_json.tmpl static/swagger-latest.json
wget https://github.com/go-gitea/gitea/blob/v1.22.4/templates/swagger/v1_json.tmpl
sed -i "$@" 's/"version": "{{AppVer | JSEscape | Safe}}"/"version": "1.22.6"/' static/swagger-22.json
rm v1_json.tmpl
for ver in '1.24.0-rc0' '1.23.8' '1.22.6' '1.21.11' '1.20.6' '1.19.4'; do
wget https://raw.githubusercontent.com/go-gitea/gitea/refs/tags/v${ver}/templates/swagger/v1_json.tmpl
sed -i "$@" "s|\"version\": \"{{AppVer \| JSEscape}}\"|\"version\": \"${ver}\"|" v1_json.tmpl
sed -i "$@" 's\"basePath": "{{AppSubUrl | JSEscape}}/api/v1"\"basePath": "https://gitea.com/api/v1"\' v1_json.tmpl
# for version < 1.21.11
sed -i "$@" "s|\"version\": \"{{AppVer \| JSEscape \| Safe}}\"|\"version\": \"${ver}\"|" v1_json.tmpl
sed -i "$@" 's\"basePath": "{{AppSubUrl | JSEscape | Safe}}/api/v1"\"basePath": "https://gitea.com/api/v1"\' v1_json.tmpl
minor=$(echo "$ver" | cut -d '.' -f 2)
mv v1_json.tmpl static/swagger-$minor.json
done
if ! [[ $(git diff --shortstat) ]]; then exit 0; fi
git config --global user.name "Gitea Bot"
+3 -1
View File
@@ -27,7 +27,7 @@ install:
npm install
.PHONY: prepare-docs
prepare-docs: install prepare-awesome-latest prepare-awesome\#19 prepare-awesome\#20 prepare-awesome\#21 prepare-awesome\#22
prepare-docs: install prepare-awesome-latest prepare-awesome\#19 prepare-awesome\#20 prepare-awesome\#21 prepare-awesome\#22 prepare-awesome\#23 prepare-awesome\#24
.PHONY: build
build:
@@ -50,3 +50,5 @@ clean:
rm -rf static/swagger-20.json
rm -rf static/swagger-21.json
rm -rf static/swagger-22.json
rm -rf static/swagger-23.json
rm -rf static/swagger-24.json
+1
View File
@@ -325,6 +325,7 @@ in the current directory.
- `--skip-attachment-data`: Skip dumping of attachment data. Optional.
- `--skip-package-data`: Skip dumping of package data. Optional.
- `--skip-log`: Skip dumping of log data. Optional.
- `--skip-index`: Skip dumping of Bleve indexer data. Optional. Applies only for bleve.
- `--database`, `-d`: Specify the database SQL syntax. Optional (supported arguments: sqlite3, mysql, mssql, postgres).
- `--verbose`, `-V`: If provided, shows additional details. Optional.
- `--type`: Set the dump output format. Optional. (formats: zip, tar, tar.sz, tar.gz, tar.xz, tar.bz2, tar.br, tar.lz4, tar.zst default: zip).
+55 -12
View File
@@ -224,6 +224,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `DEFAULT_THEME`: **gitea-auto**: Set the default theme for the Gitea installation, custom themes could be provided by `{CustomPath}/public/assets/css/theme-*.css`.
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
- `THEMES`: **_empty_**: All available themes by `{CustomPath}/public/assets/css/theme-*.css`. Allow users select personalized themes.
- `FILE_ICON_THEME`: **material**: The icons for file list (basic/material).
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
- `AMBIGUOUS_UNICODE_DETECTION`: **true**: Detect ambiguous unicode characters in file contents and show warnings on the UI
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
@@ -276,17 +277,23 @@ The following configuration set `Content-Type: application/vnd.android.package-a
## Markdown (`markdown`)
- `ENABLE_HARD_LINE_BREAK_IN_COMMENTS`: **true**: Render soft line breaks as hard line breaks in comments, which
means a single newline character between paragraphs will cause a line break and adding
trailing whitespace to paragraphs is not necessary to force a line break.
- `ENABLE_HARD_LINE_BREAK_IN_DOCUMENTS`: **false**: Render soft line breaks as hard line breaks in documents, which
means a single newline character between paragraphs will cause a line break and adding
trailing whitespace to paragraphs is not necessary to force a line break.
- `RENDER_OPTIONS_COMMENT`: **short-issue-pattern, new-line-hard-break**: Customize render options for different contexts.
Set to "none" to disable the defaults, or use comma separated list:
- short-issue-pattern: recognized "#123" issue reference and render it as a link to the issue
- new-line-hard-break: render soft line breaks as hard line breaks, which means a single newline character between
paragraphs will cause a line break and adding trailing whitespace to paragraphs is not
necessary to force a line break.
- `RENDER_OPTIONS_WIKI`: **short-issue-pattern**: see also RENDER_OPTIONS_COMMENT
- `RENDER_OPTIONS_REPO_FILE`: **_empty_**: see also RENDER_OPTIONS_COMMENT
- `CUSTOM_URL_SCHEMES`: Use a comma separated list (ftp,git,svn) to indicate additional
URL hyperlinks to be rendered in Markdown. URLs beginning in http and https are
always displayed. If this entry is empty, all URL schemes are allowed
- `FILE_EXTENSIONS`: **.md,.markdown,.mdown,.mkd,.livemd**: List of file extensions that should be rendered/edited as Markdown. Separate the extensions with a comma. To render files without any extension as markdown, just put a comma.
- `FILE_EXTENSIONS`: **.md,.markdown,.mdown,.mkd,.livemd**: List of file extensions that should be rendered/edited as Markdown.
Separate the extensions with a comma. To render files without any extension as markdown, just put a comma.
- `ENABLE_MATH`: **true**: Enables detection of `$...$`, `$$...$$`, ``` $`...`$$ ``` blocks as math blocks.
- `MATH_CODE_BLOCK_DETECTION`: **inline-dollar,block-dollar**: Enable delimiters for math code block detection.
Set to "none" to disable all, or use comma separated list: inline-dollar, inline-parentheses, block-dollar, block-square-brackets.
Default value follows GitHub.
## Server (`server`)
@@ -300,7 +307,12 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `DOMAIN`: **localhost**: Domain name of this server.
- `ROOT_URL`: **`{PROTOCOL}://{DOMAIN}:{HTTP_PORT}/`**:
Overwrite the automatically generated public URL.
This is useful if the internal and the external URL don't match (e.g. in Docker).
This is useful if the internal and the external URL don't match (e.g. behind a reverse proxy).
- `PUBLIC_URL_DETECTION`: **`legacy`**: Controls how to generate the public URL.
Although it defaults to "legacy" (to avoid breaking existing users), most instances should use the "auto" behavior,
especially when the Gitea instance needs to be accessed in a container network.
- "legacy": generate the public URL by "Host" header if "X-Forwarded-Proto" header exists, otherwise use "ROOT_URL".
- "auto": always use "Host" header, and also use "X-Forwarded-Proto" header if it exists. If no "Host" header, use "ROOT_URL".
- `STATIC_URL_PREFIX`: **_empty_**:
Overwrite this option to request static resources from a different URL.
This includes CSS files, images, JS files and web fonts.
@@ -670,15 +682,20 @@ And the following unique queues:
:::
- `REQUIRE_SIGNIN_VIEW`: **false**: Enable this to force users to log in to view any page or to use API.
It could be set to "expensive" to block anonymous users accessing some pages which consume a lot of resources,
for example: block anonymous AI crawlers from accessing repo code pages.
The "expensive" mode is experimental and subject to change.
- `ENABLE_NOTIFY_MAIL`: **false**: Enable this to send e-mail to watchers of a repository when
something happens, like creating issues. Requires `Mailer` to be enabled.
- `ENABLE_BASIC_AUTHENTICATION`: **true**: Disable this to disallow authentication using HTTP
BASIC and the user's password. Please note if you disable this you will not be able to access the
tokens API endpoints using a password. Further, this only disables BASIC authentication using the
password - not tokens or OAuth Basic.
- `ENABLE_PASSWORD_SIGNIN_FORM`: **true**: Show the password login form (for password-based login).
- `ENABLE_PASSWORD_SIGNIN_FORM`: **true**: Show the password login form (for password-based login),
otherwise, only show OAuth2 or passkey login methods if they are enabled.
If you set it to false, maybe it also needs to set `ENABLE_BASIC_AUTHENTICATION` to false to
completely disable password-based authentication.
- `ENABLE_PASSKEY_AUTHENTICATION`: **true**: Allow users to sign-in with a passkey
- `ENABLE_REVERSE_PROXY_AUTHENTICATION`: **false**: Enable this to allow reverse proxy authentication for web requests
- `ENABLE_REVERSE_PROXY_AUTHENTICATION_API`: **false**: Enable this to allow reverse proxy authentication for API requests, the reverse proxy is responsible for ensuring that no CSRF is possible.
- `ENABLE_REVERSE_PROXY_AUTO_REGISTRATION`: **false**: Enable this to allow auto-registration
@@ -736,6 +753,13 @@ And the following unique queues:
- `DISABLE_ORGANIZATIONS_PAGE`: **false**: Disable the organizations explore page.
- `DISABLE_CODE_PAGE`: **false**: Disable the code explore page.
### Request Quality of Service (`qos`)
- `ENABLED`: **false**: Enable request quality of service and overload protection.
- `MAX_INFLIGHT`: **(dynamic)**: The maximum number of concurrent requests that the server will process before enqueueing new requests. Default is "CpuNum * 4".
- `MAX_WAITING`: **100**: The maximum number of requests that can be enqueued before new requests will be dropped.
- `TARGET_WAIT_TIME`: **250ms**: Target maximum wait time a request may be enqueued for. Requests that are enqueued for less than this amount of time will not be dropped. When wait times exceed this amount, a portion of requests will be dropped until wait times have decreased below this amount.
## SSH Minimum Key Sizes (`ssh.minimum_key_sizes`)
Define allowed algorithms and their minimum key length (use -1 to disable a type):
@@ -803,6 +827,7 @@ and
- `SENDMAIL_CONVERT_CRLF`: **true**: Most versions of sendmail prefer LF line endings rather than CRLF line endings. Set this to false if your version of sendmail requires CRLF line endings.
- `SEND_BUFFER_LEN`: **100**: Buffer length of mailing queue. **DEPRECATED** use `LENGTH` in `[queue.mailer]`
- `SEND_AS_PLAIN_TEXT`: **false**: Send mails only in plain text, without HTML alternative.
- `EMBED_ATTACHMENT_IMAGES`: **false**: Embed attached images in base64 format in HTML emails. (for clients that do not load external images or disconnected vpn users still receiving emails; ATTENTION: online webclients like gmail will not show base64 embedded images)
## Override Email Headers (`mailer.override_header`)
@@ -979,7 +1004,6 @@ Default templates for project board view:
- `ENABLED`: **false**: Enable to run all cron tasks periodically with default settings.
- `RUN_AT_START`: **false**: Run cron tasks at application start-up.
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE` accept formats
- Full crontab specs, e.g. `* * * * * ?`
- Descriptors, e.g. `@midnight`, `@every 1h30m` ...
@@ -991,25 +1015,34 @@ Default templates for project board view:
- `ENABLED`: **true**: Enable service.
- `RUN_AT_START`: **true**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Whether to emit notice on successful execution too
- `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
- `OLDER_THAN`: **24h**: Archives created more than `OLDER_THAN` ago are subject to deletion, e.g. `12h`.
#### Cron - Update Mirrors (`cron.update_mirrors`)
- `ENABLED`: **true**: Enable running Update mirrors task periodically.
- `SCHEDULE`: **@every 10m**: Cron syntax for scheduling update mirrors, e.g. `@every 3h`.
- `RUN_AT_START`: **false**: Run Update mirrors task when Gitea starts.
- `NOTICE_ON_SUCCESS`: **false**: Notice if not success
- `PULL_LIMIT`: **50**: Limit the number of mirrors added to the queue to this number (negative values mean no limit, 0 will result in no mirrors being queued effectively disabling pull mirror updating).
- `PUSH_LIMIT`: **50**: Limit the number of mirrors added to the queue to this number (negative values mean no limit, 0 will result in no mirrors being queued effectively disabling push mirror updating).
#### Cron - Repository Health Check (`cron.repo_health_check`)
- `ENABLED`: **true**: Enable running Update mirrors task periodically.
- `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository health check.
- `RUN_AT_START`: **false**: Run Update mirrors task when Gitea starts.
- `NOTICE_ON_SUCCESS`: **false**: Notice if not success
- `TIMEOUT`: **60s**: Time duration syntax for health check execution timeout.
- `ARGS`: **_empty_**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. See more on http://git-scm.com/docs/git-fsck
#### Cron - Repository Statistics Check (`cron.check_repo_stats`)
- `RUN_AT_START`: **true**: Run repository statistics check at start time.
- `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository statistics check.
- `ENABLED`: **true**: Enable running Update mirrors task periodically.
- `RUN_AT_START`: **true**: Run Update mirrors task when Gitea starts.
- `NOTICE_ON_SUCCESS`: **false**: Notice if not success
#### Cron - Cleanup hook_task Table (`cron.cleanup_hook_task_table`)
@@ -1030,10 +1063,20 @@ Default templates for project board view:
#### Cron - Update Migration Poster ID (`cron.update_migration_poster_id`)
Update migrated repositories' issues and comments' posterid, it will always attempt synchronization when the instance starts.
- `ENABLED`: **true**: Enable update migration poster id job.
- `RUN_AT_START`: **true**: Update migrated repositories' issues and comments' posterid when starting server
- `NOTICE_ON_SUCCESS`: **false**: Notice if not success
- `SCHEDULE`: **@midnight** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.
#### Cron - Sync External Users (`cron.sync_external_users`)
Synchronize external user data (only LDAP user synchronization is supported)
- `ENABLED`: **true**: Enable synchronize external user data job
- `RUN_AT_START`: **false**: Synchronize external user data when starting server
- `NOTICE_ON_SUCCESS`: **false**: Notice if not success
- `SCHEDULE`: **@midnight** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.
- `UPDATE_EXISTING`: **true**: Create new users, update existing user data and disable users that are not in external source anymore (default) or only create new users if UPDATE_EXISTING is set to false.
@@ -1213,7 +1256,7 @@ This section only does "set" config, a removed config key from this section won'
## Markup (`markup`)
- `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: Set the maximum size of a Mermaid source. (Set to -1 to disable)
- `MERMAID_MAX_SOURCE_CHARACTERS`: **50000**: Set the maximum size of a Mermaid source. (Set to -1 to disable)
Gitea can support Markup using external tools. The example below will add a markup named `asciidoc`.
+122 -78
View File
@@ -9,7 +9,7 @@ aliases:
# Customizing Gitea
Customizing Gitea is typically done using the `CustomPath` folder - by default this is
the `custom` folder from the working directory (WorkPath), but may be different if your build has
the `custom` folder from the working directory (WorkPath), but may be different if your [installation](../installation/installation.md) has
set this differently. This is the central place to override configuration settings,
templates, etc. You can check the `CustomPath` using `gitea help`. You can also find
the path on the _Configuration_ tab in the _Site Administration_ page. You can override
@@ -23,7 +23,7 @@ the Linux Filesystem Standard. Gitea will attempt to create required folders, in
`custom/`. Distributions may provide a symlink for `custom` using `/etc/gitea/`.
Application settings can be found in file `CustomConf` which is by default,
`$GITEA_CUSTOM/conf/app.ini` but may be different if your build has set this differently.
`$GITEA_CUSTOM/conf/app.ini` but may be different if your [installation](../installation/installation.md) has set this differently.
Again `gitea help` will allow you review this variable and you can override it using the
`--config` option on the `gitea` binary.
@@ -165,52 +165,117 @@ Alice <-- Bob: Another authentication Response
The script will detect tags with `class="language-plantuml"`, but you can change this by providing a second argument to `parsePlantumlCodeBlocks`.
### Example: STL Preview
### Example: CAD Files Preview using Online 3D Viewer
You can display STL file directly in Gitea by adding:
You can implement CAD file preview inside your Gitea instance. This implemenation uses [`Online 3D Viewer`](https://github.com/kovacsv/Online3DViewer).
Supports following 3D file formats:
'3dm', '3ds', '3mf', 'amf', 'bim', 'brep', 'dae', 'fbx', 'fcstd', 'glb',
'gltf', 'ifc', 'igs', 'iges', 'stp', 'step', 'stl', 'obj', 'off', 'ply', 'wrl'
(Only v2 for .gltf files)
#### Part 1: Add template
In $GITEA_CUSTOM we need to add our template.
This template needs to be saved in "$GITEA_CUSTOM/templates/custom/".
Here create file "footer.tmpl" and add following text into it:
```html
<script>
function lS(src) {
return new Promise(function (resolve, reject) {
let s = document.createElement("script");
s.src = src;
s.addEventListener("load", () => {
resolve();
});
document.body.appendChild(s);
document.addEventListener('DOMContentLoaded', () => {
// Supported 3D file types
const fileTypes = ['3dm', '3ds', '3mf', 'amf', 'bim', 'brep', 'dae', 'fbx', 'fcstd', 'glb', 'gltf', 'ifc', 'igs', 'iges', 'stp', 'step', 'stl', 'obj', 'off', 'ply', 'wrl'];
// Select matching link
const links = Array.from(document.querySelectorAll('a.ui.mini.basic.button'));
const link3D = links.find(link => {
const href = link.href.toLowerCase();
return href.includes('/raw/') && fileTypes.some(ext => href.endsWith(`.${ext}`));
});
if (link3D) {
const script = document.createElement('script');
script.onload = () => {
const fileUrl = link3D.getAttribute('href');
// Prepare the container for the viewer
const fileView = document.querySelector('.file-view');
if (fileView) {
fileView.setAttribute('id', 'view-3d');
fileView.style.padding = '0';
fileView.style.margin = '0';
fileView.style.height = '400px';
fileView.style.width = '100%';
fileView.innerHTML = '';
}
if ($('.view-raw>a[href$=".stl" i]').length) {
$("body").append(
'<link href="/assets/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">'
);
Promise.all([
lS("/assets/Madeleine.js/src/lib/stats.js"),
lS("/assets/Madeleine.js/src/lib/detector.js"),
lS("/assets/Madeleine.js/src/lib/three.min.js"),
lS("/assets/Madeleine.js/src/Madeleine.js"),
]).then(function () {
$(".view-raw")
.attr("id", "view-raw")
.attr("style", "padding: 0;margin-bottom: -10px;");
new Madeleine({
target: "view-raw",
data: $('.view-raw>a[href$=".stl" i]').attr("href"),
path: "/assets/Madeleine.js/src",
});
$('.view-raw>a[href$=".stl"]').remove();
// Initialize viewer
const parentDiv = document.getElementById('view-3d');
if (parentDiv) {
const viewer = new OV.EmbeddedViewer(parentDiv, {
backgroundColor: new OV.RGBAColor(59, 68, 76, 0), // Transparent
defaultColor: new OV.RGBColor(200, 200, 200),
edgeSettings: new OV.EdgeSettings(false, new OV.RGBColor(0, 0, 0), 1),
environmentSettings: new OV.EnvironmentSettings([
'/assets/o3dv/envmaps/fishermans_bastion/negx.jpg',
'/assets/o3dv/envmaps/fishermans_bastion/posx.jpg',
'/assets/o3dv/envmaps/fishermans_bastion/posy.jpg',
'/assets/o3dv/envmaps/fishermans_bastion/negy.jpg',
'/assets/o3dv/envmaps/fishermans_bastion/posz.jpg',
'/assets/o3dv/envmaps/fishermans_bastion/negz.jpg'
], false)
});
// Load the model
viewer.LoadModelFromUrlList([fileUrl]);
}
};
script.src = '/assets/o3dv/o3dv.min.js';
document.head.appendChild(script);
}
});
</script>
```
to the file `templates/custom/footer.tmpl`
#### Part 2: Add public files
You also need to download the content of the library [Madeleine.js](https://github.com/beige90/Madeleine.js) and place it under `$GITEA_CUSTOM/public/assets/` folder.
Now we need to download latest version of O3DV. Go to "$GITEA_CUSTOM/public/assets/".
Create folder using (and cd into it):
You should end-up with a folder structure similar to:
```
mkdir o3dv
cd o3dv
```
Copy latest release zip link from [`GitHub`](https://github.com/kovacsv/Online3DViewer/releases) (v0.15.0 as of now).
Here use e.g. wget to download the file:
```
wget https://github.com/kovacsv/Online3DViewer/releases/download/0.15.0/o3dv.zip
```
Use e.g. unzip to unzip the archive:
```
unzip o3dv.zip
```
#### Part 3: Folder permissions
Now the last thing. Change permissions on the "footer.tmpl":
```
chown git:git $GITEA_CUSTOM/templates/custom/footer.tmpl
chmod 770 $GITEA_CUSTOM/templates/custom/footer.tmpl
```
And on the public folder:
```
chown -R git:git $GITEA_CUSTOM/public
```
Now we have everything ready! Restart your gitea instance to apply these changes and test it in your browser.
You should end-up with a folder structure similar to this:
```
$GITEA_CUSTOM/templates
@@ -218,49 +283,14 @@ $GITEA_CUSTOM/templates
`-- footer.tmpl
$GITEA_CUSTOM/public/assets/
-- Madeleine.js
|-- LICENSE
|-- README.md
|-- css
| |-- pygment_trac.css
| `-- stylesheet.css
|-- examples
| |-- ajax.html
| |-- index.html
| `-- upload.html
|-- images
| |-- bg_hr.png
| |-- blacktocat.png
| |-- icon_download.png
| `-- sprite_download.png
|-- models
| |-- dino2.stl
| |-- ducati.stl
| |-- gallardo.stl
| |-- lamp.stl
| |-- octocat.stl
| |-- skull.stl
| `-- treefrog.stl
`-- src
|-- Madeleine.js
|-- css
| `-- Madeleine.css
|-- icons
| |-- logo.png
| |-- madeleine.eot
| |-- madeleine.svg
| |-- madeleine.ttf
| `-- madeleine.woff
`-- lib
|-- MadeleineConverter.js
|-- MadeleineLoader.js
|-- detector.js
|-- stats.js
`-- three.min.js
-- o3dv
|-- o3dv_0.15.0.zip
|-- o3dv.license.md
|-- o3dv.min.js
|-- envmaps
\...
```
Then restart Gitea and open a STL file on your Gitea instance.
## Customizing Gitea mails
The `$GITEA_CUSTOM/templates/mail` folder allows changing the body of every mail of Gitea.
@@ -380,13 +410,27 @@ To make a custom theme available to all users:
The value of `$GITEA_CUSTOM` of your instance can be queried by calling `gitea help` and looking up the value of "CustomPath".
2. Add `<theme-name>` to the comma-separated list of setting `THEMES` in `app.ini`, or leave `THEMES` empty to allow all themes.
A custom theme file named `theme-my-theme.css` will be displayed as `my-theme` on the user's theme selection page.
It could add theme meta information into the custom theme CSS file to provide more information about the theme.
If a custom theme is a dark theme, please set the global css variable `--is-dark-theme: true` in the `:root` block.
This allows Gitea to adjust the Monaco code editor's theme accordingly.
An "auto" theme could be implemented by using "theme-gitea-auto.css" as a reference.
```css
gitea-theme-meta-info {
--theme-display-name: "My Awesome Theme"; /* this theme will be display as "My Awesome Theme" on the UI */
}
:root {
--is-dark-theme: true; /* if it is a dark theme */
--color-primary: #112233;
/* more custom theme variables ... */
}
```
Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gitea/awesome-gitea#themes).
The default theme sources can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/css/themes).
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
This allows Gitea to adjust the Monaco code editor's theme accordingly.
## Customizing fonts
Fonts can be customized using CSS variables:
+1 -1
View File
@@ -23,7 +23,7 @@ In order to get file rendering through external binaries, their associated packa
If you're using a Docker image, your `Dockerfile` should contain something along this lines:
```docker
FROM docker.io/gitea/gitea:@dockerVersion@
FROM docker.gitea.com/gitea:@dockerVersion@
[...]
COPY custom/app.ini /data/gitea/conf/app.ini
+3 -2
View File
@@ -35,8 +35,9 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
to authenticate using `BasicAuth` and a password, as follows:
```sh
$ curl -H "Content-Type: application/json" -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
$ curl -H "Content-Type: application/json" -d '{"name":test_token","scopes":["read:activitypub","read:issue", "write:misc", "read:notification", "read:organization", "read:package", "read:repository", "read:user"]}'
-u 'username:password' "https://gitea.your.host/api/v1/users/{username}/tokens"
{"id":1,"name":"test_token","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
```
The ``sha1`` (the token) is only returned once and is not stored in
+1
View File
@@ -80,6 +80,7 @@ The approval page displayed to the user shows the list of scopes requested by th
| OpenID Connect Discovery | `/.well-known/openid-configuration` |
| Authorization Endpoint | `/login/oauth/authorize` |
| Access Token Endpoint | `/login/oauth/access_token` |
| Token Introspection Endpoint | `/login/oauth/introspect` |
| OpenID Connect UserInfo | `/login/oauth/userinfo` |
| JSON Web Key Set | `/login/oauth/keys` |
+2 -2
View File
@@ -330,9 +330,9 @@ It is highly recommended to back-up your database before running these commands.
- Add your (bare) repositories to the correct spot for your configuration (`repository.ROOT`), ensuring they are in the correct layout `<REPO_ROOT>/[user]/[repo].git`.
- **Note:** the directory names must be lowercase.
- You can also check `<ROOT_URL>/admin/config` for the repository root path.
- You can also check `<ROOT_URL>/-/admin/config` for the repository root path.
- Ensure that the user/org exists that you want to adopt repositories for.
- As an admin, go to `<ROOT_URL>/admin/repos/unadopted` and search.
- As an admin, go to `<ROOT_URL>/-/admin/repos/unadopted` and search.
- Users can also be given similar permissions via config [`ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES`](../administration/config-cheat-sheet.md#repository-repository).
- If the above steps are done correctly, you should be able to select repositories to adopt.
- If no repositories are found, enable [debug logging](../administration/config-cheat-sheet.md#repository-repository) to check for any specific errors.
+2 -1
View File
@@ -24,9 +24,10 @@ All steps below requires that the database engine of your choice is installed on
## MySQL/MariaDB
1. For remote database setup, you will need to make MySQL listen to your IP address. Edit `bind-address` option on `/etc/mysql/my.cnf` on database instance to:
1. For remote database setup, you will need to make MySQL listen to your IP address. Configure the `bind-address` option in `/etc/mysql/my.cnf` on database instance by adding the following lines:
```ini
[mysqld]
bind-address = 203.0.113.3
```
+8 -8
View File
@@ -20,7 +20,7 @@ the official [install instructions](https://docs.docker.com/compose/install/).
## Basics
The most simple setup just creates a volume and a network and starts the `docker.io/gitea/gitea:latest-rootless`
The most simple setup just creates a volume and a network and starts the `docker.gitea.com/gitea:latest-rootless`
image as a service. Since there is no database available, one can be initialized using SQLite3.
Create a directory for `data` and `config`:
@@ -38,7 +38,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
volumes:
- ./data:/var/lib/gitea
@@ -71,7 +71,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
volumes:
- ./data:/var/lib/gitea
@@ -95,7 +95,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
+ environment:
+ - GITEA__database__DB_TYPE=mysql
+ - GITEA__database__HOST=db:3306
@@ -136,7 +136,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
environment:
+ - GITEA__database__DB_TYPE=postgres
+ - GITEA__database__HOST=db:5432
@@ -184,7 +184,7 @@ version: "2"
+
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
volumes:
- - ./data:/var/lib/gitea
@@ -211,7 +211,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
+ user: 1001
volumes:
@@ -283,7 +283,7 @@ docker-compose up -d
- Rename folder (inside volume) gitea to custom
- Edit app.ini if needed
- Set START_SSH_SERVER = true
- Use image docker.io/gitea/gitea:@dockerVersion@-rootless
- Use image docker.gitea.com/gitea:@dockerVersion@-rootless
## Managing Deployments With Environment Variables
+15 -9
View File
@@ -18,7 +18,7 @@ the official [install instructions](https://docs.docker.com/compose/install/).
## Basics
The most simple setup just creates a volume and a network and starts the `docker.io/gitea/gitea:latest`
The most simple setup just creates a volume and a network and starts the `docker.gitea.com/gitea:latest`
image as a service. Since there is no database available, one can be initialized using SQLite3.
Create a directory like `gitea` and paste the following content into a file named `docker-compose.yml`.
Note that the volume should be owned by the user/group with the UID/GID specified in the config file.
@@ -34,7 +34,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -66,7 +66,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -101,7 +101,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -152,7 +152,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -208,7 +208,7 @@ networks:
+
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
restart: always
networks:
@@ -266,6 +266,8 @@ files; for named volumes, this is done through another container or by direct ac
`/var/lib/docker/volumes/gitea_gitea/_data`. The configuration file will be saved at
`/data/gitea/conf/app.ini` after the installation.
Example: Analogous to the non-docker-installation customization linked above, you can create a `/public` folder within `/data/gitea` and place your custom `robots.txt` there which will then be served normally.
## Upgrading
:::warning
@@ -316,8 +318,8 @@ Gitea will generate new secrets/tokens for every new installation automatically
The following commands will output a new `SECRET_KEY` and `INTERNAL_TOKEN` to `stdout`, which you can then place in your environment variables.
```bash
docker run -it --rm docker.io/gitea/gitea:1 gitea generate secret SECRET_KEY
docker run -it --rm docker.io/gitea/gitea:1 gitea generate secret INTERNAL_TOKEN
docker run -it --rm docker.gitea.com/gitea:1 gitea generate secret SECRET_KEY
docker run -it --rm docker.gitea.com/gitea:1 gitea generate secret INTERNAL_TOKEN
```
```yaml
@@ -331,7 +333,7 @@ services:
## SSH Container Passthrough
Since SSH is running inside the container, SSH needs to be passed through from the host to the container if SSH support is desired. One option would be to run the container SSH on a non-standard port (or moving the host port to a non-standard port). Another option which might be more straightforward is for Gitea users to ssh to a Gitea user on the host which will then relay those connections to the docker.
Since SSH is running inside the container, SSH needs to be passed through from the host to the container if SSH support is desired. One option would be to run the container SSH on a non-standard port (or moving the host port to a non-standard port). Another option which might be more straightforward is for Gitea users to ssh to a Gitea user on the host which will then relay those connections to the docker. Alternatively, if the host machine has more than one IP address, the host can listen on one and Gitea on another.
### Understanding SSH access to Gitea (without passthrough)
@@ -642,3 +644,7 @@ If you try to login as the `git` user on the host in future you will `ssh` direc
Never add the `Gitea Host Key` as a SSH key to a user on the Gitea interface.
SSHing shims could be created similarly to above.
### SSH with multiple IP addresses
This assumes that the host machine has more than one reachable IP address: `192.168.1.1` (host) `192.168.1.2` (gitea)
On the host machine, configure SSHD in `/etc/ssh/sshd_config` to listen on one IP address `ListenAddress 192.168.1.1`. In the compose file the SSH port forwarding then needs to be changed to `"192.168.1.2:22:22"`. The port forwarding needs to be adjusted similarily for all other forwarded ports to avoid problems with DNS.
+3 -3
View File
@@ -48,7 +48,7 @@ Note that the repository may still use instance-level or organization-level runn
Before register the runner and run it, you need a registration token. The level of the runner determines where to obtain the registration token.
- Instance level: The admin settings page, like `<your_gitea.com>/admin/actions/runners`.
- Instance level: The admin settings page, like `<your_gitea.com>/-/admin/actions/runners`.
- Organization level: The organization settings page, like `<your_gitea.com>/<org>/settings/actions/runners`.
- Repository level: The repository settings page, like `<your_gitea.com>/<owner>/<repo>/settings/actions/runners`.
@@ -210,7 +210,7 @@ Mac uses `launchd` in place of systemd for registering daemon processes. By defa
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>HOME></key>
<key>HOME</key>
<string>/var/lib/act_runner</string>
</dict>
<key>UserName</key>
@@ -320,7 +320,7 @@ services:
When using docker, there is no requirement to enter the container and manually run `./act_runner daemon` command as shown below. Once the container has been started successfully, it will show up as an active runner in your Gitea instance.
## Advantage Configurations
## Advanced Configurations
### Configuring cache when starting a Runner using docker image
+2 -1
View File
@@ -16,7 +16,7 @@ It is designed to be compatible with [GitHub Actions workflow badge](https://doc
You can use the following URL to get the badge:
```
https://your-gitea-instance.com/{owner}/{repo}/actions/workflows/{workflow_file}/badge.svg?branch={branch}&event={event}
https://your-gitea-instance.com/{owner}/{repo}/actions/workflows/{workflow_file}/badge.svg?branch={branch}&event={event}&style={style}
```
- `{owner}`: The owner of the repository.
@@ -24,3 +24,4 @@ https://your-gitea-instance.com/{owner}/{repo}/actions/workflows/{workflow_file}
- `{workflow_file}`: The name of the workflow file.
- `{branch}`: Optional. The branch of the workflow. Default to your repository's default branch.
- `{event}`: Optional. The event of the workflow. Default to none.
- `{style}`: Optional. Style of the badge, either `flat` or `flat-square`. Default to `flat`.
+22 -20
View File
@@ -55,6 +55,23 @@ If you want to give more permissions to the runner, allowing it to access more p
Refined permission control to Actions is a complicated job.
In the future, we will add more options to Gitea to make it more configurable, such as allowing more write access to repositories or read access to all repositories in the same organization.
## Which operating systems are supported by act runner?
We released official binaries for Linux, macOS, and Windows.
While other operating systems are theoretically supported if it is supported by golang and docker(docker mode enabled).
One thing to note is that if you choose to run jobs directly on the host instead of in job containers, the environmental differences between operating systems may cause unexpected failures.
For example, bash is not available on Windows in most cases, while act tries to use bash to run scripts by default.
Therefore, you need to specify `powershell` as the default shell in your workflow file, see [defaults.run](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun).
```yaml
defaults:
run:
shell: powershell
```
## How to avoid being hacked?
There are two types of possible attacks: unknown runner stealing the code or secrets from your repository, or malicious scripts controlling your runner.
@@ -72,22 +89,6 @@ Here's how we do it on [gitea.com](http://gitea.com/):
- To run actions for fork pull requests, approval is required. See [#22803](https://github.com/go-gitea/gitea/pull/22803).
- If someone registers their own runner for their repository or organization on [gitea.com](http://gitea.com/), we have no objections and will just not use it in our org. However, they should take care to ensure that the runner is not used by other users they do not know.
## Which operating systems are supported by act runner?
It works well on Linux, macOS, and Windows.
While other operating systems are theoretically supported, they require further testing.
One thing to note is that if you choose to run jobs directly on the host instead of in job containers, the environmental differences between operating systems may cause unexpected failures.
For example, bash is not available on Windows in most cases, while act tries to use bash to run scripts by default.
Therefore, you need to specify `powershell` as the default shell in your workflow file, see [defaults.run](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun).
```yaml
defaults:
run:
shell: powershell
```
## Why choose GitHub Actions? Why not something compatible with GitLab CI/CD?
[@lunny](https://gitea.com/lunny) has explained this in the [issue to implement actions](https://github.com/go-gitea/gitea/issues/13539).
@@ -100,7 +101,7 @@ It is exciting to be able to reuse them.
This is valid syntax.
It means that it should run on runners that have both the `label_a` **and** `label_b` labels, see [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on).
Unfortunately, act runner does not work this way.
Unfortunately, act runner does not work this way until v0.2.11.
As mentioned, we map labels to environments:
- `ubuntu` → `ubuntu:22.04`
@@ -137,9 +138,10 @@ In the meantime, we suggest that you re-register your runner if you want to chan
## Will there be more implementations for Gitea Actions runner?
Although we would like to provide more options, our limited manpower means that act runner will be the only officially supported runner.
However, both Gitea and act runner are completely open source, so anyone can create a new/better implementation.
We support your choice, no matter how you decide.
Although we would like to provide more options, our limited manpower means that act runner will be the only officially supported runner at the moment.
However, both Gitea and act runner are completely open source under MIT License, so anyone can modify the code to satisfy their requirements.
In case you fork act runner to create your own version: Please contribute the changes back if you can and if you think your changes will help others as well.
## What workflow trigger events does Gitea support?
+3 -7
View File
@@ -10,7 +10,7 @@ Starting with Gitea **1.19**, Gitea Actions are available as a built-in CI/CD so
## Name
It is similar and compatible to [GitHub Actions](https://github.com/features/actions), and its name is inspired by it too.
It is similar and mostly compatible to [GitHub Actions](https://github.com/features/actions), and its name is inspired by it too.
To avoid confusion, we have clarified the spelling here:
- "Gitea Actions" (with an "s", both words capitalized) is the name of the Gitea feature.
@@ -22,7 +22,7 @@ To avoid confusion, we have clarified the spelling here:
Just like other CI/CD solutions, Gitea doesn't run the jobs itself, but delegates the jobs to runners.
The runner of Gitea Actions is called [act runner](https://gitea.com/gitea/act_runner), it is a standalone program and also written in Go.
It is based on a [fork](https://gitea.com/gitea/act) of [nektos/act](http://github.com/nektos/act).
An important part of the application comes from a [fork](https://gitea.com/gitea/act) of [nektos/act](http://github.com/nektos/act).
Because the runner is deployed independently, there could be potential security issues.
To avoid them, please follow two simple rules:
@@ -35,8 +35,4 @@ However, for public Gitea instances, such as [gitea.com](https://gitea.com), the
## Status
Gitea Actions is still under development, so there may be some bugs and missing features.
And breaking changes may be made before it's stable (v1.20 or later).
If the situation changes, we will update it here.
So please refer to the content here when you find outdated articles elsewhere.
Gitea Actions is stable enough for production usage and we use Gitea Actions in all the repositories in https://gitea.com/gitea.
+3 -3
View File
@@ -30,7 +30,7 @@ In order to avoid consuming too many resources and affecting the Gitea instance,
You can use the [pre-built binaries](http://dl.gitea.com/act_runner) or the [docker images](https://hub.docker.com/r/gitea/act_runner/tags) to set up the runner.
Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your local host.
Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your localhost.
And it could be easier to debug if something goes wrong.
The runner can run the jobs in isolated Docker containers, so you need to make sure that the Docker has been installed and Docker daemon is running.
@@ -55,7 +55,7 @@ If you are unsure which address to use, the LAN address is usually the right cho
Each token can be used to create multiple runners, until it is replaced with a new token using the reset link.
You can obtain different levels of 'tokens' from the following places to create the corresponding level of 'runners':
- Instance level: The admin settings page, like `<your_gitea.com>/admin/actions/runners`.
- Instance level: The admin settings page, like `<your_gitea.com>/-/admin/actions/runners`.
- Organization level: The organization settings page, like `<your_gitea.com>/<org>/settings/actions/runners`.
- Repository level: The repository settings page, like `<your_gitea.com>/<owner>/<repo>/settings/actions/runners`.
@@ -115,7 +115,7 @@ jobs:
:::warning
Certain actions may not function correctly within SHA256 repositories. This includes [actions/checkout](https://github.com/actions/checkout/issues/1843).
Certain actions may not function correctly within SHA256 repositories or when Gitea runs on subpath. This includes [actions/checkout](https://github.com/actions/checkout/issues/1843).
:::
+102
View File
@@ -0,0 +1,102 @@
---
date: "2025-04-05T00:00:00+08:00"
slug: "markdown"
---
# Markdown
Gitea uses MarkDown structured text in many places, you can recognise it by the `.md` file extension.
Markdown is plain text format for writing structured documents, allowing one to write
"plain" text files that nonetheless have _"fancy"_ **formatting**, while still keeping the plain-text version readable.
Unfortunately, due to historical implementation differences, many subtle dialects exist.
To avoid adding to the confusion, Gitea tries to follow "[GitHub Flavoured Markdown (GFM)](https://help.github.com/articles/github-flavored-markdown/)" as close as possible.
"GFM" is an extension on top of the rigorously-specified [CommonMark](https://commonmark.org/) standard.
CommonMark flavours are used by most major web platforms (e.g. Reddit, Stack Overflow, Discourse)
and git forges (GitHub, GitLab and our very own Gitea), thus you shouldn't run into any surprises with Gitea.
For a quick introduction to the syntax and features of GitHub Flavoured Markdown, see the GitHub documentation:
- [Basic formatting](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)
- [Advanced formatting](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting)
For a deeper history about CommonMark, its spec, and its reason for existence, see [CommonMark.org](https://commonmark.org/).
## Rendering options
Some Gitea's markdown rendering behaviors can be fine-tuned by global config options, see the `[markdown]` config section in the `app.example.ini`
## Link path resolving
When rendering links for `<a href>`, `<img src>` and `<video src>`, Gitea resolves the link paths in the rendering context.
- If the link is an absolute path with scheme, the link is kept as-is.
- If the link is an URL path, it is resolved with the base path of current rendering context.
- In a comment-like context (issues, pull-requests, commit message), the base path is current repository's home link: `/owner-name/repo-name`.
- In a repository file context (markdown files in the repository), the base path is current git ref path.
### Special link tokens
To make users easier to resolve a link to the Gitea instance's root path, Gitea has a special `/:root` path syntax.
This will always resolve to Gitea's ROOT_URL.
Gitea also supports GitHub's `?raw=1` query parameter.
A request to `/owner-name/repo-name/src/branch/main/file?raw=1` will be redirected to
`/owner-name/repo-name/raw/branch/main/file`. This makes it possible to target raw contents from relative links
(normally, the `src/` section of the path is provided automatically by Gitea and cannot be overriden).
### Link handling examples
For example, when rendering a markdown file in `/owner-name/repo-name/src/branch/main/dir`:
1) Absolute with scheme: Link `https://example.org` will be rendered as-is.
2) Relative from current file: Link `sub/file`is resolved to `/owner-name/repo-name/src/branch/main/dir/sub/file`
3) Relative from repo root: Link `/sub/file` (note leading slash) is resolved to `/owner-name/repo-name/src/branch/main/sub/file`
4) Raw media: If the link is used as `src` of an image or video, then it is resolved to `/owner-name/repo-name/raw/...`
5) Raw relative: `sub/file?raw=1` will resolve to `/owner-name/repo-name/src/branch/main/dir/sub/file?raw=1`,
which will redirect to `/owner-name/repo-name/raw/branch/main/dir/sub/file`.
6) explicit root: Link `/:root/any-path` is always resolved to `$ROOT_URL/any-path` without any further processing.
## Issue and pull-request reference
Using issue/pull-request numbers in a list:
```
* #123
* #456
```
It will be rendered with issue titles to:
```
* the issue title (#123)
* the other issue title (#456)
```
## Math expressions
Gitea supports GitHub-like math expression formatting.
### Inline expression
- ``` $\alpha$ ```: quoted by single-dollar `$`
- ``` $$\alpha$$ ```: quoted by double-dollar `$$`
- ``` $`\alpha`$ ```: quoted by dollar with backquotes, the backquotes could repeat like normal code blocks.
### Block expression
Using `$$`:
````
$$
\alpha
$$
````
Using code-block with language:
````
```math
\alpha
```
````
+300 -234
View File
File diff suppressed because it is too large. Load diff
@@ -5,7 +5,6 @@ sidebar_position: 110
aliases:
- /zh-cn/adding-legal-pages
---
# 添加法律页面
@@ -10,7 +10,7 @@ aliases:
## 轻量级目录访问协议(Lightweight Directory Access Protocol,LDAP)
通过BindDN的LDAP和简单认证方式LDAP共享以下字段:
通过 BindDN 的 LDAP 和简单认证方式 LDAP 共享以下字段:
- 认证名称 **(必选)**
@@ -27,48 +27,52 @@ aliases:
- 例如: LDAP `389`/ LDAPs `636`
- 安全协议 (可选)
- 连接LDAP服务器时是否使用TLS协议。
- 连接 LDAP 服务器时是否使用 TLS 协议。
- 管理员过滤规则 (可选)
- 一个LDAP过滤器,用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件,则该用户将被授予管理员权限。
- 一个 LDAP 过滤器,用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件,则该用户将被授予管理员权限。
- 示例:`(objectClass=adminAccount)`
- 适用于Microsoft Active Directory(AD)的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
- 适用于 Microsoft Active Directory(AD)的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
- 用户名属性(可选)
- 用户LDAP记录中包含用户名称的属性。在第一次成功登录后,将使用指定的属性值作为新的Gitea账户用户名。若留空,则使用登录表单上提供的用户名。
- 当提供的登录名与多个属性匹配时,这一选项非常有用,但是只有一个特定属性应该用于Gitea账户名称,请参阅"用户过滤器"。
- 用户 LDAP 记录中包含用户名称的属性。在第一次成功登录后,将使用指定的属性值作为新的 Gitea 账户用户名。若留空,则使用登录表单上提供的用户名。
- 当提供的登录名与多个属性匹配时,这一选项非常有用,但是只有一个特定属性应该用于 Gitea 账户名称,请参阅"用户过滤器"。
- 示例:uid
- 适用于Microsoft Active Directory(AD)的示例:`sAMAccountName`
- 适用于 Microsoft Active Directory(AD)的示例:`sAMAccountName`
- 名字属性(可选)
- 用户LDAP记录中包含用户名字的属性。将用于填充他们的账户信息。
- 用户 LDAP 记录中包含用户名字的属性。将用于填充他们的账户信息。
- 示例:givenName
- 姓氏属性(可选)
- 用户LDAP记录中包含用户姓氏的属性。将用于填充他们的账户信息。
- 用户 LDAP 记录中包含用户姓氏的属性。将用于填充他们的账户信息。
- 示例:`sn`
- 电子邮件属性 **(必选)**
- 用户LDAP记录中包含用户电子邮件地址的属性。将用于填充他们的账户信息。
- 用户 LDAP 记录中包含用户电子邮件地址的属性。将用于填充他们的账户信息。
- 示例:`mail`
### LDAP(via BindDN)
需要额外设置以下字段:
- 绑定DN (可选)
- 绑定 DN (可选)
- 搜索用户时绑定到LDAP服务器的DN。这可以留空以执行匿名搜索。
- 搜索用户时绑定到 LDAP 服务器的 DN。这可以留空以执行匿名搜索。
- 示例: `cn=Search,dc=mydomain,dc=com`
- 绑定密码 (可选)
- 上述指定的Bind DN(绑定区别名)的密码,如果有的话。注意:该密码在服务器上使用SECRET_KEY进行加密存储。仍然建议确保Bind DN具有尽可能少的权限。
- 上述指定的 Bind DN(绑定区别名)的密码,如果有的话。注意:该密码在服务器上使用 SECRET_KEY 进行加密存储。仍然建议确保 Bind DN 具有尽可能少的权限。
- 用户搜索基准 **(必选)**
- 这是用于搜索用户帐户的LDAP基础路径.
- 这是用于搜索用户帐户的 LDAP 基础路径.
- 示例: `ou=Users,dc=mydomain,dc=com`
- 用户过滤规则 **(必选)**
@@ -79,19 +83,19 @@ aliases:
- 如需多次替换,应使用 `%[1]s`,例如在将提供的登录名与多个属性(如用户标识符、电子邮件甚至电话号码)进行匹配时。
- 示例: `(&(objectClass=Person)(|(uid=%[1]s)(mail=%[1]s)(mobile=%[1]s)))`
- 启用用户同步
- 这个选项启用了一个周期性任务,用于将Gitea用户与LDAP服务器进行同步。默认的同步周期是每24小时,
但您可以在app.ini文件中进行更改。
- 这个选项启用了一个周期性任务,用于将 Gitea 用户与 LDAP 服务器进行同步。默认的同步周期是每 24 小时,
但您可以在 app.ini 文件中进行更改。
有关此部分的详细说明,请参阅[sample
app.ini](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
的_cron.sync_external_users_ 部分的注释。前面提到的_User Search Base_和_User Filter_
设置将限制哪些用户可以使用Gitea以及哪些用户将被同步。
在初始运行任务时,将根据给定的设置创建所有与LDAP匹配的用户,因此在使用大型企业LDAP目录时需要小心。
的*cron.sync_external_users* 部分的注释。前面提到的*User Search Base*和*User Filter*
设置将限制哪些用户可以使用 Gitea 以及哪些用户将被同步。
在初始运行任务时,将根据给定的设置创建所有与 LDAP 匹配的用户,因此在使用大型企业 LDAP 目录时需要小心。
### LDAP(simple auth)
需要额外设置以下字段:
- 用户DN **(必选)**
- 用户 DN **(必选)**
- 用作用户 DN 的模板。匹配参数 `%s` 将替换为登录表单中的登录名。
- 示例: `cn=%s,ou=Users,dc=mydomain,dc=com`
@@ -108,11 +112,12 @@ aliases:
- 示例: `(&(objectClass=posixAccount)(|(cn=%[1]s)(mail=%[1]s)))`
- 示例: `(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))`
### 使用LDAP验证分组成员
### 使用 LDAP 验证分组成员
使用以下字段:
- 群组搜索基础DN(可选)
- 群组搜索基础 DN(可选)
- 组使用的 LDAP DN。
- 示例: `ou=group,dc=mydomain,dc=com`
@@ -132,43 +137,46 @@ aliases:
## 可插拔式认证模块(Pluggable Authentication Module,PAM)
这个过程启用了PAM(Pluggable Authentication Modules)认证。用户仍然可以通过用户管理手动添加到系统中。
PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加到当前数据库中。为了与普通的Linux密码一起使用,
运行Gitea的用户还必须具有对`/etc/shadow`的读取权限,以便在使用公钥登录时检查账户的有效性。
这个过程启用了 PAM(Pluggable Authentication Modules)认证。用户仍然可以通过用户管理手动添加到系统中。
PAM 提供了一种机制,通过对用户进行 PAM 认证来自动将其添加到当前数据库中。为了与普通的 Linux 密码一起使用,
运行 Gitea 的用户还必须具有对`/etc/shadow`的读取权限,以便在使用公钥登录时检查账户的有效性。
**注意**:如果用户已将SSH公钥添加到Gitea中,使用这些密钥可能会绕过登录检查系统。因此,
如果您希望禁用使用PAM进行身份验证的用户,应该在Gitea中手动禁用该账户,使用内置的用户管理功能。
**注意**:如果用户已将 SSH 公钥添加到 Gitea 中,使用这些密钥可能会绕过登录检查系统。因此,
如果您希望禁用使用 PAM 进行身份验证的用户,应该在 Gitea 中手动禁用该账户,使用内置的用户管理功能。
1. 配置和安装准备.
- 建议您创建一个管理用户.
- 建议取消自动注册.
1. 一旦数据库已初始化完成,使用新创建的管理员账户登录.
1. 导航至用户设置(右上角的图标),然后选择
`Site Administration` -> `Authentication Sources`, 并选择
`Add Authentication Source`.
`Site Administration` -> `Authentication Sources`, 并选择
`Add Authentication Source`.
1. 填写字段如下:
- 认证类型:`PAM`。
- 名称:任何有效的值都可以,如果您愿意,可以使用"System Authentication"。
- PAM服务名称:从/etc/pam.d/目录下选择适用于所需认证的正确文件[^1]。
- PAM电子邮件域:用户认证时要附加的电子邮件后缀。例如,如果登录系统期望一个名为gituse的用户,
并且将此字段设置为mail.com,那么Gitea在验证一个GIT实例的用户时将期望user emai字段为gituser@mail.com[^2]。
- PAM 服务名称:从/etc/pam.d/目录下选择适用于所需认证的正确文件[^1]。
- PAM 电子邮件域:用户认证时要附加的电子邮件后缀。例如,如果登录系统期望一个名为 gituse 的用户,
并且将此字段设置为 mail.com,那么 Gitea 在验证一个 GIT 实例的用户时将期望 user emai 字段为gituser@mail.com[^2]。
**Note**: PAM 支持通过[build-time flags](installation/from-source.md#build)添加,
而官方提供的二进制文件通常不会默认启用此功能。PAM需要确保系统上有必要的libpam动态库,并且编译器可以访问必要的PAM开发头文件。
而官方提供的二进制文件通常不会默认启用此功能。PAM 需要确保系统上有必要的 libpam 动态库,并且编译器可以访问必要的 PAM 开发头文件。
[^1]: 例如,在Debian "Bullseye"上使用标准Linux登录,可以使用`common-session-noninteractive`。这个值对于其他版本的Debian,
包括Ubuntu和Mint,可能也是有效的,请查阅您所使用发行版的文档以确认。
[^1]:
例如,在 Debian "Bullseye"上使用标准 Linux 登录,可以使用`common-session-noninteractive`。这个值对于其他版本的 Debian,
包括 Ubuntu 和 Mint,可能也是有效的,请查阅您所使用发行版的文档以确认。
[^2]: **PAM的必选项** 请注意:在上面的示例中,用户将作为`gituser`而不是`[email protected]`登录到Gitea的Web界面。
[^2]: **PAM 的必选项** 请注意:在上面的示例中,用户将作为`gituser`而不是`[email protected]`登录到 Gitea 的 Web 界面。
## 简单邮件传输协议(Simple Mail Transfer Protocol,SMTP)
此选项允许 Gitea 以 Gitea 用户身份登录 SMTP 主机。请设置以下字段:
- 身份验证名称 **(必选)**
- 分配给新授权方法的名称
- SMTP 验证类型 **(必选)**
- 用于连接 SMTP 主机的验证类型,plain 或 login
- 主机名 **(必选)**
@@ -188,7 +196,7 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
- 示例: `gitea.com,mydomain.com,mydomain2.com`
- 强制使用 SMTPS
- 默认情况下将使用SMTPS连接到端口465.如果您希望将smtp用于其他端口,自行设置
- 默认情况下将使用 SMTPS 连接到端口 465.如果您希望将 smtp 用于其他端口,自行设置
- 否则,如果服务器提供' STARTTLS '扩展名,则将使用此扩展名
- 跳过 TLS 验证
- 禁用 TLS 验证身份.
@@ -199,7 +207,7 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
- 要使用 FreeIPA 凭据登录 Gitea,需要为 Gitea 创建一个绑定帐户。
创建一个绑定帐户:
- 在FreeIPA服务器上创建一个gitea.ldif文件,并将`dc=example,dc=com`替换为您的`dn`,然后提供一个适当安全的密码。
- 在 FreeIPA 服务器上创建一个 gitea.ldif 文件,并将`dc=example,dc=com`替换为您的`dn`,然后提供一个适当安全的密码。
```sh
dn: uid=gitea,cn=sysaccounts,cn=etc,dc=example,dc=com
@@ -212,33 +220,33 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
nsIdleTimeout: 0
```
- 导入LDIF文件(如果需要,请将localhost更改为IPA服务器)。系统会提示您输入Directory Manager的密码。:
- 导入 LDIF 文件(如果需要,请将 localhost 更改为 IPA 服务器)。系统会提示您输入 Directory Manager 的密码。:
```sh
ldapmodify -h localhost -p 389 -x -D \
"cn=Directory Manager" -W -f gitea.ldif
```
- 为`gitea_users`添加IPA组:
- 为`gitea_users`添加 IPA 组:
```sh
ipa group-add --desc="Gitea Users" gitea_users
```
- **提示**:对于IPA凭证错误,运行' kinit admin '并提供域管理帐户密码.
- 以管理员身份登录Gitea,点击Admin Panel下的`Authentication`。然后单击`Add New Source`并填写详细信息,更改所有适当的地方。
- **提示**:对于 IPA 凭证错误,运行' kinit admin '并提供域管理帐户密码.
- 以管理员身份登录 Gitea,点击 Admin Panel 下的`Authentication`。然后单击`Add New Source`并填写详细信息,更改所有适当的地方。
## SPNEGO with SSPI (Kerberos/NTLM, for Windows only)
Gitea支持通过Windows内置的安全支持提供程序接口(Security Support Provider Interface,SSPI)实现SPNEGO单点登录认证(由RFC4559定义的方案),用于服务器的Web部分。SSPI仅在Windows环境中工作,即当服务器和客户端都在Windows操作系统上运行时。
Gitea 支持通过 Windows 内置的安全支持提供程序接口(Security Support Provider Interface,SSPI)实现 SPNEGO 单点登录认证(由 RFC4559 定义的方案),用于服务器的 Web 部分。SSPI 仅在 Windows 环境中工作,即当服务器和客户端都在 Windows 操作系统上运行时。
在激活SSPI单点登录认证(SSO)之前,您需要准备您的环境:
在激活 SSPI 单点登录认证(SSO)之前,您需要准备您的环境:
- 在Active Directory中创建一个单独的用户账户,gitea.exe 进程将在该账户下运行(例如,在domain.local域下创建一个名为user的账户:
- 为运行gitea.exe的主机创建一个服务主体名称(Service Principal Name,SPN),其类别为HTTP:
- 在 Active Directory 中创建一个单独的用户账户,gitea.exe 进程将在该账户下运行(例如,在 domain.local 域下创建一个名为 user 的账户:
- 为运行 gitea.exe 的主机创建一个服务主体名称(Service Principal Name,SPN),其类别为 HTTP:
- 以特权域用户(例如域管理员)的身份启动“命令提示符”或“PowerShell”。
- 运行下面的命令,将host.domain.local替换为Web应用程序将运行的服务器的完全限定域名(FQDN),将domain\user替换为在前一步中创建的账户名称:
- 运行下面的命令,将 host.domain.local 替换为 Web 应用程序将运行的服务器的完全限定域名(FQDN),将 domain\user 替换为在前一步中创建的账户名称:
```sh
setspn -A HTTP/host.domain.local domain\user
@@ -247,22 +255,22 @@ Gitea支持通过Windows内置的安全支持提供程序接口(Security Suppo
在遵循上述步骤之前,请确保您按照以下流程进行操作:
1. 用之前创建的用户登录(如果已经登录,请先注销)。
2. 确保在`custom/conf/app.ini`文件的`[server]`部分中,`ROOT_URL`设置为Web应用程序将运行的服务器的完全限定域名(FQDN),与之前创建服务主体名称时使用的一致(例如,`host.domain.local`)。
3. 启动Web服务器(运行 `gitea.exe web`)。
4. 在 `Site Administration -> Authentication Sources` 中添加一个 `SPNEGO with SSPI` 认证源,以启用SSPI认证。
2. 确保在`custom/conf/app.ini`文件的`[server]`部分中,`ROOT_URL`设置为 Web 应用程序将运行的服务器的完全限定域名(FQDN),与之前创建服务主体名称时使用的一致(例如,`host.domain.local`)。
3. 启动 Web 服务器(运行 `gitea.exe web`)。
4. 在 `Site Administration -> Authentication Sources` 中添加一个 `SPNEGO with SSPI` 认证源,以启用 SSPI 认证。
5. 在域中的客户端计算机上,使用任何域用户登录(与运行`gitea.exe`的服务器不同)。
6. 如果您使用Chrome或Edge浏览器,请将Web应用程序的URL添加到“本地站点”(`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
7. 启动Chrome或Edge浏览器,导航到Gitea的FQDN URL(例如,`http://host.domain.local:3000`)。
8. 在控制面板中点击“Sign In”按钮,然后选择SSPI,将会自动使用当前登录到计算机的用户进行登录。
6. 如果您使用 Chrome 或 Edge 浏览器,请将 Web 应用程序的 URL 添加到“本地站点”(`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
7. 启动 Chrome 或 Edge 浏览器,导航到 Gitea 的 FQDN URL(例如,`http://host.domain.local:3000`)。
8. 在控制面板中点击“Sign In”按钮,然后选择 SSPI,将会自动使用当前登录到计算机的用户进行登录。
9. 如果无法正常工作,请确保:
- 您不是在运行`gitea.exe`的同一台服务器上运行Web浏览器。应该在与服务器不同的域加入计算机(客户端)上运行Web浏览器。如果客户端和服务器都在同一台计算机上运行,则NTLM将优先于Kerberos。
- 主机上只有一个`HTTP/...`的SPN。
- SPN中只包含主机名,不包含端口号。
- 将Web应用程序的URL添加到"本地站点"。
- 服务器和客户端的时钟差异不超过5分钟(取决于组策略)。
- 在Internet Explorer中启用了"集成Windows身份验证"(在"高级设置"下)。
- 您不是在运行`gitea.exe`的同一台服务器上运行 Web 浏览器。应该在与服务器不同的域加入计算机(客户端)上运行 Web 浏览器。如果客户端和服务器都在同一台计算机上运行,则 NTLM 将优先于 Kerberos。
- 主机上只有一个`HTTP/...`的 SPN。
- SPN 中只包含主机名,不包含端口号。
- 将 Web 应用程序的 URL 添加到"本地站点"。
- 服务器和客户端的时钟差异不超过 5 分钟(取决于组策略)。
- 在 Internet Explorer 中启用了"集成 Windows 身份验证"(在"高级设置"下)。
遵循这些步骤,您应该能够成功启用和使用SSPI单点登录认证(SSO)。
遵循这些步骤,您应该能够成功启用和使用 SSPI 单点登录认证(SSO)。
## 反向代理认证
@@ -279,7 +287,7 @@ ENABLE_REVERSE_PROXY_AUTHENTICATION = true
如果设置了 `ENABLE_REVERSE_PROXY_FULL_NAME=true`,则用户的全名会从 `X-WEBAUTH-FULLNAME` 读取,这样在自动创建用户时将使用这个字段作为用户全名,你也可以通过修改 `REVERSE_PROXY_AUTHENTICATION_FULL_NAME` 来变更 HTTP 头。
你也可以通过修改 `REVERSE_PROXY_TRUSTED_PROXIES` 来设置反向代理的IP地址范围,加强安全性,默认值是 `127.0.0.0/8,::1/128`。 通过 `REVERSE_PROXY_LIMIT`, 可以设置最多信任几级反向代理。
你也可以通过修改 `REVERSE_PROXY_TRUSTED_PROXIES` 来设置反向代理的 IP 地址范围,加强安全性,默认值是 `127.0.0.0/8,::1/128`。 通过 `REVERSE_PROXY_LIMIT`, 可以设置最多信任几级反向代理。
你可以通过以下配置为 API 启用此认证方法:
@@ -5,12 +5,11 @@ sidebar_position: 11
aliases:
- /zh-cn/backup-and-restore
---
# 备份与恢复
Gitea 已经实现了 `dump` 命令可以用来备份所有需要的文件到一个zip压缩文件。该压缩文件可以被用来进行数据恢复。
Gitea 已经实现了 `dump` 命令可以用来备份所有需要的文件到一个 zip 压缩文件。该压缩文件可以被用来进行数据恢复。
## 备份一致性
@@ -20,7 +19,7 @@ Gitea 包括数据库、文件和 Git 仓库,当它被使用时所有这些都
## 备份命令 (`dump`)
先转到git用户的权限: `su git`. 再Gitea目录运行 `./gitea dump`。一般会显示类似如下的输出:
先转到 git 用户的权限: `su git`. 再 Gitea 目录运行 `./gitea dump`。一般会显示类似如下的输出:
```
2016/12/27 22:32:09 Creating tmp work dir: /tmp/gitea-dump-417443001
@@ -33,12 +32,12 @@ Gitea 包括数据库、文件和 Git 仓库,当它被使用时所有这些都
最后生成的 `gitea-dump-1482906742.zip` 文件将会包含如下内容:
* `app.ini` - 如果原先存储在默认的 custom/ 目录之外,则是配置文件的可选副本
* `custom/` - 所有保存在 `custom/` 目录下的配置和自定义的文件。
* `data/` - 数据目录(APP_DATA_PATH),如果使用文件会话,则不包括会话。该目录包括 `attachments`、`avatars`、`lfs`、`indexers`、如果使用 SQLite 则包括 SQLite 文件。
* `repos/` - 仓库目录的完整副本。
* `gitea-db.sql` - 数据库dump出来的 SQL。
* `log/` - Logs文件,如果用作迁移不是必须的。
- `app.ini` - 如果原先存储在默认的 custom/ 目录之外,则是配置文件的可选副本
- `custom/` - 所有保存在 `custom/` 目录下的配置和自定义的文件。
- `data/` - 数据目录(APP_DATA_PATH),如果使用文件会话,则不包括会话。该目录包括 `attachments`、`avatars`、`lfs`、`indexers`、如果使用 SQLite 则包括 SQLite 文件。
- `repos/` - 仓库目录的完整副本。
- `gitea-db.sql` - 数据库 dump 出来的 SQL。
- `log/` - Logs 文件,如果用作迁移不是必须的。
中间备份文件将会在临时目录进行创建,如果您要重新指定临时目录,可以用 `--tempdir` 参数,或者用 `TMPDIR` 环境变量。
@@ -53,7 +52,7 @@ mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
pg_dump -U $USER $DATABASE > gitea-db.sql
```
### 使用Docker (`dump`)
### 使用 Docker (`dump`)
在使用 Docker 时,使用 `dump` 命令有一些注意事项。
@@ -5,7 +5,6 @@ sidebar_position: 20
aliases:
- /zh-cn/cmd-embedded
---
# 嵌入资源提取工具
@@ -30,7 +29,7 @@ gitea embedded list [--include-vendored] [patterns...]
- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
列出 `public/assets/img` 目录下的所有文件:`public/assets/img/**`
列出 `public/assets/img` 目录下的所有文件:`public/assets/img/**`
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。
@@ -5,7 +5,6 @@ sidebar_position: 1
aliases:
- /zh-cn/command-line
---
# 命令行
@@ -61,7 +60,7 @@ aliases:
- 选项:
- `--email`:要删除的用户的电子邮件。
- `--username`:要删除的用户的用户名。
- `--id`:要删除的用户的ID。
- `--id`:要删除的用户的 ID。
- 必须提供 `--id`、`--username` 或 `--email` 中的一个。如果提供多个,则所有条件必须匹配。
- 示例:
- `gitea admin user delete --id 1`
@@ -283,12 +282,12 @@ aliases:
### cert
生成自签名的SSL证书。将输出到当前目录下的`cert.pem`和`key.pem`文件中,并且会覆盖任何现有文件。
生成自签名的 SSL 证书。将输出到当前目录下的`cert.pem`和`key.pem`文件中,并且会覆盖任何现有文件。
- 选项:
- `--host value`:逗号分隔的主机名和IP地址列表,此证书适用于这些主机。支持使用通配符。必填。
- `--ecdsa-curve value`:用于生成密钥的ECDSA曲线。可选。有效选项为P224、P256、P384、P521。
- `--rsa-bits value`:要生成的RSA密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:3072)。
- `--host value`:逗号分隔的主机名和 IP 地址列表,此证书适用于这些主机。支持使用通配符。必填。
- `--ecdsa-curve value`:用于生成密钥的 ECDSA 曲线。可选。有效选项为 P224、P256、P384、P521。
- `--rsa-bits value`:要生成的 RSA 密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:3072)。
- `--start-date value`:证书的创建日期。可选。(格式:`Jan 1 15:04:05 2011`)。
- `--duration value`:证书有效期。可选。(默认值:8760h0m0s)
- `--ca`:如果提供此选项,则证书将生成自己的证书颁发机构。可选。
@@ -297,18 +296,18 @@ aliases:
### dump
将所有文件和数据库导出到一个zip文件中。输出文件将保存在当前目录下,类似于`gitea-dump-1482906742.zip`。
将所有文件和数据库导出到一个 zip 文件中。输出文件将保存在当前目录下,类似于`gitea-dump-1482906742.zip`。
- 选项:
- `--file name`,`-f name`:指定要创建的导出文件的名称。可选。(默认值:gitea-dump-[timestamp].zip)。
- `--tempdir path`,`-t path`:指定临时目录的路径。可选。(默认值:/tmp)。
- `--skip-repository`,`-R`:跳过仓库的导出。可选。
- `--skip-custom-dir`:跳过自定义目录的导出。可选。
- `--skip-lfs-data`:跳过LFS数据的导出。可选。
- `--skip-lfs-data`:跳过 LFS 数据的导出。可选。
- `--skip-attachment-data`:跳过附件数据的导出。可选。
- `--skip-package-data`:跳过包数据的导出。可选。
- `--skip-log`:跳过日志数据的导出。可选。
- `--database`,`-d`:指定数据库的SQL语法。可选。
- `--database`,`-d`:指定数据库的 SQL 语法。可选。
- `--verbose`,`-V`:如果提供此选项,显示附加详细信息。可选。
- `--type`:设置导出的格式。可选。(默认值:zip)
- 示例:
@@ -401,19 +400,19 @@ gitea doctor recreate-table
- 命令:
- `shutdown`: 优雅地关闭运行中的进程
- `restart`: 优雅地重新启动运行中的进程(对于Windows服务器尚未实现)
- `restart`: 优雅地重新启动运行中的进程(对于 Windows 服务器尚未实现)
- `flush-queues`: 刷新运行中的进程中的队列
- 选项:
- `--timeout value`: 刷新过程的超时时间(默认值: 1m0s)
- `--non-blocking`: 设置为true,以在返回之前不等待刷新完成
- `--non-blocking`: 设置为 true,以在返回之前不等待刷新完成
- `logging`: 调整日志命令
- 命令:
- `pause`: 暂停日志记录
- 注意:
- 如果日志级别低于此级别,日志级别将被临时提升为INFO。
- Gitea将在一定程度上缓冲日志,并在超过该点后丢弃日志。
- 如果日志级别低于此级别,日志级别将被临时提升为 INFO。
- Gitea 将在一定程度上缓冲日志,并在超过该点后丢弃日志。
- `resume`: 恢复日志记录
- `release-and-reopen`: 使Gitea释放和重新打开用于日志记录的文件和连接(相当于向Gitea发送SIGUSR1信号)。
- `release-and-reopen`: 使 Gitea 释放和重新打开用于日志记录的文件和连接(相当于向 Gitea 发送 SIGUSR1 信号)。
- `remove name`: 删除指定的日志记录器
- 选项:
- `--group group`, `-g group`: 从中删除子记录器的组(默认为`default`)
@@ -429,7 +428,7 @@ gitea doctor recreate-table
- `--expression value`, `-e value`: 日志记录器的匹配表达式
- `--prefix value`, `-p value`: 日志记录器的前缀
- `--color`: 在日志中使用颜色
- `--stderr`: 将控制台日志输出到stderr - 仅适用于控制台
- `--stderr`: 将控制台日志输出到 stderr - 仅适用于控制台
- `file`: 添加文件日志记录器
- 选项:
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
@@ -459,9 +458,9 @@ gitea doctor recreate-table
- `--color`: 在日志中使用颜色
- `--reconnect-on-message`, `-R`: 对于每个消息重新连接主机
- `--reconnect`, `-r`: 连接中断时重新连接主机
- `--protocol value`, `-P value`: 设置要使用的协议:tcp、unix或udp(默认为tcp)
- `--protocol value`, `-P value`: 设置要使用的协议:tcp、unix 或 udp(默认为 tcp)
- `--address value`, `-a value`: 要连接到的主机地址和端口(默认为:7020)
- `smtp`: 添加SMTP日志记录器
- `smtp`: 添加 SMTP 日志记录器
- 选项:
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
File diff suppressed because it is too large. Load diff
@@ -5,14 +5,13 @@ sidebar_position: 100
aliases:
- /zh-cn/customizing-gitea
---
# 自定义 Gitea 配置
Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板等默认配置。
如果从二进制部署 Gitea ,则所有默认路径都将相对于该 gitea 二进制文件;如果从发行版安装,则可能会将这些路径修改为Linux文件系统标准。Gitea
如果从二进制部署 Gitea ,则所有默认路径都将相对于该 gitea 二进制文件;如果从发行版安装,则可能会将这些路径修改为 Linux 文件系统标准。Gitea
将会自动创建包括 `custom/` 在内的必要应用目录,应用本身的配置存放在
`custom/conf/app.ini` 当中。在发行版中可能会以 `/etc/gitea/` 的形式为 `custom` 设置一个符号链接,查看配置详情请移步:
@@ -66,7 +65,7 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
除了 `extra_links.tmpl` 和 `extra_tabs.tmpl`,您可以在您的 `custom/templates/custom/` 目录中存放一些其他有用的模板,例如:
- `header.tmpl`,在 `<head>` 标记结束之前的模板,例如添加自定义CSS文件
- `header.tmpl`,在 `<head>` 标记结束之前的模板,例如添加自定义 CSS 文件
- `body_outer_pre.tmpl`,在 `<body>` 标记开始处的模板
- `body_inner_pre.tmpl`,在顶部导航栏之前,但在主 container 内部的模板,例如添加一个 `<div class="full height">`
- `body_inner_post.tmpl`,在主 container 结束处的模板
@@ -5,7 +5,6 @@ sidebar_position: 12
aliases:
- /zh-cn/email-setup
---
# Email 设置
@@ -16,9 +15,9 @@ Gitea 具有邮件功能,用于发送事务性邮件(例如注册确认邮
使用 `sendmail` 命令作为邮件传输代理(mailer)。
注意:对于在官方Gitea Docker镜像中使用,请使用SMTP版本进行配置(请参考下一节)。
注意:对于在官方 Gitea Docker 镜像中使用,请使用 SMTP 版本进行配置(请参考下一节)。
注意:对于面向互联网的网站,请查阅您的 MTA 文档以了解通过TLS发送邮件的说明。同时设置 SPF、DMARC 和 DKIM DNS 记录,以使发送的邮件被各个电子邮件提供商接受为合法邮件。
注意:对于面向互联网的网站,请查阅您的 MTA 文档以了解通过 TLS 发送邮件的说明。同时设置 SPF、DMARC 和 DKIM DNS 记录,以使发送的邮件被各个电子邮件提供商接受为合法邮件。
```ini title="app.ini"
[mailer]
@@ -55,9 +54,9 @@ PASSWD = `password`
- 通过端口 587 的 STARTTLS(也称为 Opportunistic TLS)。初始连接是明文的,但如果服务器支持,则可以升级为 TLS。
- 通过默认端口 465 的 SMTPS 连接。连接到服务器从一开始就使用 TLS。
- 使用 `PROTOCOL=smtps` 进行强制的 SMTPS 连接。(这两种方式都被称为 Implicit TLS)
这是由于 Go 内部库对 STRIPTLS 攻击的保护机制。
这是由于 Go 内部库对 STRIPTLS 攻击的保护机制。
请注意,自2018年起,[RFC8314](https://tools.ietf.org/html/rfc8314#section-3) 推荐使用 Implicit TLS。
请注意,自 2018 年起,[RFC8314](https://tools.ietf.org/html/rfc8314#section-3) 推荐使用 Implicit TLS。
### Gmail
@@ -5,7 +5,6 @@ sidebar_position: 10
aliases:
- /zh-cn/environment-variables
---
# 环境变量清单
@@ -20,31 +19,31 @@ GITEA_CUSTOM=/home/gitea/custom ./gitea web
因为 Gitea 使用 Go 语言编写,因此它使用了一些相关的 Go 的配置参数:
* `GOOS`
* `GOARCH`
* [`GOPATH`](https://go.dev/cmd/go/#hdr-GOPATH_environment_variable)
- `GOOS`
- `GOARCH`
- [`GOPATH`](https://go.dev/cmd/go/#hdr-GOPATH_environment_variable)
您可以在[官方文档](https://go.dev/cmd/go/#hdr-Environment_variables)中查阅这些配置参数的详细信息。
## Gitea 的文件目录
* `GITEA_WORK_DIR`:工作目录的绝对路径
* `GITEA_CUSTOM`:默认情况下 Gitea 使用默认目录 `GITEA_WORK_DIR`/custom,您可以使用这个参数来配置 *custom* 目录
* `GOGS_WORK_DIR`: 已废弃,请使用 `GITEA_WORK_DIR` 替代
* `GOGS_CUSTOM`: 已废弃,请使用 `GITEA_CUSTOM` 替代
- `GITEA_WORK_DIR`:工作目录的绝对路径
- `GITEA_CUSTOM`:默认情况下 Gitea 使用默认目录 `GITEA_WORK_DIR`/custom,您可以使用这个参数来配置 _custom_ 目录
- `GOGS_WORK_DIR`: 已废弃,请使用 `GITEA_WORK_DIR` 替代
- `GOGS_CUSTOM`: 已废弃,请使用 `GITEA_CUSTOM` 替代
## 操作系统配置
* `USER`:Gitea 运行时使用的系统用户,它将作为一些 repository 的访问地址的一部分
* `USERNAME`: 如果没有配置 `USER`, Gitea 将使用 `USERNAME`
* `HOME`: 用户的 home 目录,在 Windows 中会使用 `USERPROFILE` 环境变量
- `USER`:Gitea 运行时使用的系统用户,它将作为一些 repository 的访问地址的一部分
- `USERNAME`: 如果没有配置 `USER`, Gitea 将使用 `USERNAME`
- `HOME`: 用户的 home 目录,在 Windows 中会使用 `USERPROFILE` 环境变量
### 仅限于 Windows 的配置
* `USERPROFILE`: 用户的主目录,如果未配置则会使用 `HOMEDRIVE` + `HOMEPATH`
* `HOMEDRIVE`: 用于访问 home 目录的主驱动器路径(C盘)
* `HOMEPATH`:在指定主驱动器下的 home 目录相对路径
- `USERPROFILE`: 用户的主目录,如果未配置则会使用 `HOMEDRIVE` + `HOMEPATH`
- `HOMEDRIVE`: 用于访问 home 目录的主驱动器路径(C 盘)
- `HOMEPATH`:在指定主驱动器下的 home 目录相对路径
## Miscellaneous
* `SKIP_MINWINSVC`:如果设置为 1,在 Windows 上不会以 service 的形式运行。
- `SKIP_MINWINSVC`:如果设置为 1,在 Windows 上不会以 service 的形式运行。
@@ -5,7 +5,6 @@ sidebar_position: 60
aliases:
- /zh-cn/external-renderers
---
# 外部渲染器
@@ -24,7 +23,7 @@ Gitea 通过外部二进制文件支持自定义文件渲染(例如 Jupyter no
如果您正在使用 Docker 镜像,则您的 `Dockerfile` 应该包含以下内容:
```docker
FROM docker.io/gitea/gitea:@dockerVersion@
FROM docker.gitea.com/gitea:@dockerVersion@
[...]
COPY custom/app.ini /data/gitea/conf/app.ini
@@ -171,7 +170,8 @@ ALLOW_DATA_URI_IMAGES = true
.markup.XXXXX body {
color: #444;
font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
font-family: Georgia, Palatino, "Palatino Linotype", Times, "Times New Roman",
serif;
font-size: 12px;
line-height: 1.7;
padding: 1em;
@@ -5,7 +5,6 @@ sidebar_position: 16
aliases:
- /zh-cn/fail2ban-setup
---
# 设置 Fail2ban
@@ -5,7 +5,6 @@ sidebar_position: 12
aliases:
- /zh-cn/git-lfs-setup
---
# Git LFS 设置
@@ -18,7 +18,7 @@ aliases:
目前,以下通知事件使用模板:
| 操作名称 | 用途 |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| ---------- | ---------------------------------------------------------------------- |
| `new` | 创建了新的工单或合并请求。 |
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
| `close` | 关闭了工单或合并请求。 |
@@ -72,10 +72,10 @@ custom/templates/mail/pull/comment.tmpl
指定 _主题_ 部分是可选的(因此也是虚线分隔符)。在使用时,_主题_ 和 _邮件正文_ 模板之间的分隔符需要至少三个虚线;分隔符行中不允许使用其他字符。
_主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
_主题_ 和 _邮件正文_ 由 [Golang 的模板引擎](https://go.dev/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
| 名称 | 类型 | 可用性 | 用途 |
| -------------------- | ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ------------------ | ---------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_。 |
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
@@ -107,7 +107,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
- 删除所有前导、尾随和多余的空格。
- 将字符串截断为前 256 个字母(字符)。
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用Gitea的**内部默认值**。
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用 Gitea 的**内部默认值**。
内部默认(回退)主题相当于:
@@ -117,7 +117,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
例如:`Re: [mike/stuff] New color palette (#38)`
即使存在有效的主题模板,Gitea的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
即使存在有效的主题模板,Gitea 的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
### 模板中的邮件正文部分
@@ -139,7 +139,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
如果模板无法呈现,则只有在发送邮件时才会注意到。
如果主题模板失败,将使用默认主题,如果从 _邮件正文_ 中成功呈现了任何内容,则将使用该内容,忽略其他内容。
如果遇到问题,请检查 [Gitea的日志](../administration/logging-config.md) 以获取错误消息。
如果遇到问题,请检查 [Gitea 的日志](../administration/logging-config.md) 以获取错误消息。
## 示例
@@ -221,11 +221,11 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
>
> #### 消息内容
>
> \_********************************\_********************************
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
>
> Mike, I think we should tone down the blues a little.
>
> \_********************************\_********************************
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
>
> [在 Gitea 上查看](#)。
@@ -234,7 +234,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
模板系统包含一些函数,可用于进一步处理和格式化消息。以下是其中一些函数的列表:
| 函数名 | 参数 | 可用于 | 用法 |
|------------------| ----------- | ------------ | ------------------------------ |
| ---------------- | ----------- | ---------- | ------------------------------------------------ |
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
@@ -245,8 +245,10 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
这些都是 _函数_,而不是元数据,因此必须按以下方式使用:
```html
像这样使用: {{SanitizeHTML "Escape<my>text"}}
或者这样使用: {{"Escape<my>text" | SanitizeHTML}}
或者这样使用: {{AppUrl}}
但不要像这样使用: {{.AppUrl}}
像这样使用: {{SanitizeHTML "Escape<my
>text"}} 或者这样使用: {{"Escape<my
>text" | SanitizeHTML}} 或者这样使用: {{AppUrl}} 但不要像这样使用:
{{.AppUrl}}</my
></my
>
```
@@ -30,7 +30,7 @@ REPO_INDEXER_EXCLUDE = resources/bin/**
### 按路径选择要索引的文件
Gitea使用 [`gobwas/glob` 库](https://github.com/gobwas/glob) 中的 glob 模式匹配来选择要包含在索引中的文件。
Gitea 使用 [`gobwas/glob` 库](https://github.com/gobwas/glob) 中的 glob 模式匹配来选择要包含在索引中的文件。
限制文件列表可以防止索引被派生或无关的文件(例如 lss、sym、map 等)污染,从而使搜索结果更相关。这还有助于减小索引的大小。
@@ -229,7 +229,7 @@ git.example.com {
1. 在 IIS 中设置一个空网页,比如命名为 `Gitea Proxy`。
2. 根据[微软社区中为 IIS 设置 URL 重写的指南](https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222#M343)的前两步进行配置,也就是:
- 使用 Microsoft Web Platform Installer 5.1 (WebPI) 安装 Application Request Routing(简称ARR),或者在 [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing) 下载这个插件。
- 使用 Microsoft Web Platform Installer 5.1 (WebPI) 安装 Application Request Routing(简称 ARR),或者在 [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing) 下载这个插件。
- 一但这个模块被安装到 IIS 上,你将会在 IIS 管理控制台看到一个叫做 URL Rewrite 的新图标。
- 打开 IIS 管理控制台,在左边的列表中点击 `Gitea Proxy` 网页。在中间选中并且双击 URL Rewrite 的图标来加载 URL 重写的面板。
- 在管理控制台的右边选择 `Add Rule` 操作,并且在 `Inbound and Outbound Rules` 分类中选择 `Reverse Proxy Rule`。
@@ -22,7 +22,7 @@ User-agent: *
Disallow: /
```
如果您将Gitea安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`。
如果您将 Gitea 安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`。
```txt
User-agent: *
@@ -69,7 +69,7 @@ MERGES = pubkey, twofa, basesigned, commitssigned
如果您有自己定制的 Gitea git 配置,您应该将这些配置设置在系统 git 配置文件中(例如 `/etc/gitconfig`)或者 Gitea 的内部 git 配置文件 `{[git].HOME_PATH}/.gitconfig` 中。
与 git 命令相关的主目录文件(如 `.gnupg`)也应该放在 Gitea 的 git 主目录 `[git].HOME_PATH` 中。
如果您希望将 `.gnupg` 目录放在 `{[git].HOME_PATH}/` 之外的位置,请考虑设置 `$GNUPGHOME` 环境变量为您首选的位置,否则Gitea将会从 `{[git].HOME_PATH}/.gnupg` 查找私钥。
如果您希望将 `.gnupg` 目录放在 `{[git].HOME_PATH}/` 之外的位置,请考虑设置 `$GNUPGHOME` 环境变量为您首选的位置,否则 Gitea 将会从 `{[git].HOME_PATH}/.gnupg` 查找私钥。
:::
### `INITIAL_COMMIT`
@@ -10,40 +10,40 @@ aliases:
## 背景
Gitea使用Golang作为后端编程语言。它使用了许多第三方包,并且自己也编写了一些包。
例如,Gitea使用[Chi](https://github.com/go-chi/chi)作为基本的Web框架。[Xorm](https://xorm.io)是一个用于与数据库交互的ORM框架。
Gitea 使用 Golang 作为后端编程语言。它使用了许多第三方包,并且自己也编写了一些包。
例如,Gitea 使用[Chi](https://github.com/go-chi/chi)作为基本的 Web 框架。[Xorm](https://xorm.io)是一个用于与数据库交互的 ORM 框架。
因此,管理这些包非常重要。在开始编写后端代码之前,请参考以下准则。
## 包设计准则
### 包列表
为了保持易于理解的代码并避免循环依赖,拥有良好的代码结构是很重要的。Gitea后端分为以下几个部分:
为了保持易于理解的代码并避免循环依赖,拥有良好的代码结构是很重要的。Gitea 后端分为以下几个部分:
- `build`:帮助构建Gitea的脚本。
- `cmd`:包含所有Gitea的实际子命令,包括web、doctor、serv、hooks、admin等。`web`将启动Web服务。`serv`和`hooks`将被Git或OpenSSH调用。其他子命令可以帮助维护Gitea。
- `build`:帮助构建 Gitea 的脚本。
- `cmd`:包含所有 Gitea 的实际子命令,包括 web、doctor、serv、hooks、admin 等。`web`将启动 Web 服务。`serv`和`hooks`将被 Git 或 OpenSSH 调用。其他子命令可以帮助维护 Gitea。
- `tests`:常用的测试函数
- `tests/integration`:集成测试,用于测试后端回归。
- `tests/e2e`:端到端测试,用于测试前端和后端的兼容性和视觉回归。
- `models`:包含由xorm用于构建数据库表的数据结构。它还包含查询和更新数据库的函数。应避免与其他Gitea代码的依赖关系。在某些情况下,比如日志记录时可以例外。
- `models/db`:基本的数据库操作。所有其他`models/xxx`包都应依赖于此包。`GetEngine`函数只能从models/中调用。
- `models`:包含由 xorm 用于构建数据库表的数据结构。它还包含查询和更新数据库的函数。应避免与其他 Gitea 代码的依赖关系。在某些情况下,比如日志记录时可以例外。
- `models/db`:基本的数据库操作。所有其他`models/xxx`包都应依赖于此包。`GetEngine`函数只能从 models/中调用。
- `models/fixtures`:单元测试和集成测试中使用的示例数据。一个`yml`文件表示一个将在测试开始时加载到数据库中的表。
- `models/migrations`:存储不同版本之间的数据库迁移。修改数据库结构的PR**必须**包含一个迁移步骤。
- `modules`:在Gitea中处理特定功能的不同模块。工作正在进行中:其中一些模块应该移到`services`中,特别是那些依赖于models的模块,因为它们依赖于数据库。
- `modules/setting`:存储从ini文件中读取的所有系统配置,并在各处引用。但是在可能的情况下,应将其作为函数参数使用。
- `modules/git`:用于与`Git`命令行或Gogit包交互的包。
- `public`:编译后的前端文件(JavaScript、图像、CSS等)
- `routers`:处理服务器请求。由于它使用其他Gitea包来处理请求,因此其他包(models、modules或services)不能依赖于routers。
- `routers/api`:包含`/api/v1`相关路由,用于处理RESTful API请求。
- `models/migrations`:存储不同版本之间的数据库迁移。修改数据库结构的 PR**必须**包含一个迁移步骤。
- `modules`:在 Gitea 中处理特定功能的不同模块。工作正在进行中:其中一些模块应该移到`services`中,特别是那些依赖于 models 的模块,因为它们依赖于数据库。
- `modules/setting`:存储从 ini 文件中读取的所有系统配置,并在各处引用。但是在可能的情况下,应将其作为函数参数使用。
- `modules/git`:用于与`Git`命令行或 Gogit 包交互的包。
- `public`:编译后的前端文件(JavaScript、图像、CSS 等)
- `routers`:处理服务器请求。由于它使用其他 Gitea 包来处理请求,因此其他包(models、modules 或 services)不能依赖于 routers。
- `routers/api`:包含`/api/v1`相关路由,用于处理 RESTful API 请求。
- `routers/install`:只能在系统处于安装模式(INSTALL_LOCK=false)时响应。
- `routers/private`:仅由内部子命令调用,特别是`serv`和`hooks`。
- `routers/web`:处理来自Web浏览器或Git SMART HTTP协议的HTTP请求。
- `routers/web`:处理来自 Web 浏览器或 Git SMART HTTP 协议的 HTTP 请求。
- `services`:用于常见路由操作或命令执行的支持函数。使用`models`和`modules`来处理请求。
- `templates`:用于生成HTML输出的Golang模板。
- `templates`:用于生成 HTML 输出的 Golang 模板。
### 包依赖关系
由于Golang不支持导入循环,我们必须仔细决定包之间的依赖关系。这些包之间有一些级别。以下是理想的包依赖关系方向。
由于 Golang 不支持导入循环,我们必须仔细决定包之间的依赖关系。这些包之间有一些级别。以下是理想的包依赖关系方向。
`cmd` -> `routers` -> `services` -> `models` -> `modules`
@@ -88,18 +88,18 @@ func UpdateIssue(ctx context.Context, repoID int64) error {
### 导入别名
由于有一些使用相同包名的包,例如`modules/user`、`models/user`和`services/user`,当这些包在一个Go文件中被导入时,很难知道我们使用的是哪个包以及它是变量名还是导入名。因此,我们始终建议使用导入别名。为了与常见的驼峰命名法的包变量区分开,建议使用**snake_case**作为导入别名的命名规则。
由于有一些使用相同包名的包,例如`modules/user`、`models/user`和`services/user`,当这些包在一个 Go 文件中被导入时,很难知道我们使用的是哪个包以及它是变量名还是导入名。因此,我们始终建议使用导入别名。为了与常见的驼峰命名法的包变量区分开,建议使用**snake_case**作为导入别名的命名规则。
例如:`import user_service "code.gitea.io/gitea/services/user"`
### 重要注意事项
- 永远不要写成`x.Update(exemplar)`,而没有明确的`WHERE`子句:
- 这将导致表中的所有行都被使用exemplar的非零值进行更新,包括ID。
- 这将导致表中的所有行都被使用 exemplar 的非零值进行更新,包括 ID。
- 通常应该写成`x.ID(id).Update(exemplar)`。
- 如果在迁移过程中使用`x.Insert(exemplar)`向表中插入记录,而ID是预设的:
- 对于MSSQL变体,你将需要执行``SET IDENTITY_INSERT `table` ON``(否则迁移将失败)
- 对于PostgreSQL,你还需要更新ID序列,否则迁移将悄无声息地通过,但后续的插入将失败:
``SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false)``
- 如果在迁移过程中使用`x.Insert(exemplar)`向表中插入记录,而 ID 是预设的:
- 对于 MSSQL 变体,你将需要执行`` SET IDENTITY_INSERT `table` ON ``(否则迁移将失败)
- 对于 PostgreSQL,你还需要更新 ID 序列,否则迁移将悄无声息地通过,但后续的插入将失败:
`` SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false) ``
### 未来的任务
@@ -16,10 +16,10 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
源文件可以在以下目录中找到:
* **CSS 样式**: `web_src/css/`
* **JavaScript 文件**: `web_src/js/`
* **Vue 组件**: `web_src/js/components/`
* **Go HTML 模板**: `templates/`
- **CSS 样式**: `web_src/css/`
- **JavaScript 文件**: `web_src/js/`
- **Vue 组件**: `web_src/js/components/`
- **Go HTML 模板**: `templates/`
## 通用准则
@@ -28,9 +28,9 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
## Gitea 特定准则
1. 每个功能(Fomantic-UI/jQuery 模块)应放在单独的文件/目录中。
2. HTML 的 id 和 class 应使用 kebab-case,最好包含2-3个与功能相关的关键词。
3. 在 JavaScript 中使用的 HTML 的 id 和 class 应在整个项目中是唯一的,并且应包含2-3个与功能相关的关键词。建议在仅在 JavaScript 中使用的 class 中使用 `js-` 前缀。
4. 不应覆盖框架提供的 class 的 CSS 样式。始终使用具有2-3个与功能相关的关键词的新 class 名称来覆盖框架样式。Gitea 中的帮助 CSS 类在 `helpers.less` 中。
2. HTML 的 id 和 class 应使用 kebab-case,最好包含 2-3 个与功能相关的关键词。
3. 在 JavaScript 中使用的 HTML 的 id 和 class 应在整个项目中是唯一的,并且应包含 2-3 个与功能相关的关键词。建议在仅在 JavaScript 中使用的 class 中使用 `js-` 前缀。
4. 不应覆盖框架提供的 class 的 CSS 样式。始终使用具有 2-3 个与功能相关的关键词的新 class 名称来覆盖框架样式。Gitea 中的帮助 CSS 类在 `helpers.less` 中。
5. 后端可以通过使用`ctx.PageData["myModuleData"] = map[]{}`将复杂数据传递给前端,但不要将整个模型暴露给前端,以避免泄露敏感数据。
6. 简单页面和与 SEO 相关的页面使用 Go HTML 模板渲染生成静态的 Fomantic-UI HTML 输出。复杂页面可以使用 Vue3。
7. 明确变量类型,优先使用`elem.disabled = true`而不是`elem.setAttribute('disabled', 'anything')`,优先使用`$el.prop('checked', var === 'yes')`而不是`$el.prop('checked', var)`。
@@ -39,11 +39,11 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。
11. 推荐使用自定义事件名称前缀`ce-`。
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-ellipsis`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
13. 尽量避免内联脚本和样式,建议将JS代码放入JS文件中并使用CSS类。如果内联脚本和样式不可避免,请解释无法避免的原因。
13. 尽量避免内联脚本和样式,建议将 JS 代码放入 JS 文件中并使用 CSS 类。如果内联脚本和样式不可避免,请解释无法避免的原因。
### 可访问性 / ARIA
在历史上,Gitea大量使用了可访问性不友好的框架 Fomantic UI。
在历史上,Gitea 大量使用了可访问性不友好的框架 Fomantic UI。
Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`),
但仍然存在许多问题需要大量的工作和时间来修复。
@@ -54,16 +54,16 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
推荐的实现方式:
* Vue + Vanilla JS
* Fomantic-UI(jQuery)
* htmx (部分页面重新加载其他静态组件)
* Vanilla JS
- Vue + Vanilla JS
- Fomantic-UI(jQuery)
- htmx (部分页面重新加载其他静态组件)
- Vanilla JS
不推荐的实现方式:
* Vue + Fomantic-UI(jQuery)
* jQuery + Vanilla JS
* htmx + 任何其他需要大量 JavaScript 代码或不必要的功能,如 htmx 脚本 (`hx-on`)
- Vue + Fomantic-UI(jQuery)
- jQuery + Vanilla JS
- htmx + 任何其他需要大量 JavaScript 代码或不必要的功能,如 htmx 脚本 (`hx-on`)
为了保持界面一致,Vue 组件可以使用 Fomantic-UI 的 CSS 类。
尽管不建议混合使用不同的框架,
@@ -83,7 +83,7 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
如果我们想在非异步上下文中调用`async`函数,
建议使用`const _promise = asyncFoo()`来告诉读者
这是有意为之的,我们想调用异步函数并忽略Promise。
这是有意为之的,我们想调用异步函数并忽略 Promise。
一些 lint 规则和 IDE 也会在未处理返回的 Promise 时发出警告。
### 获取数据
@@ -97,31 +97,41 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
禁止使用`dataset`,它的驼峰命名行为使得搜索属性变得困难。
然而,仍然存在一些特殊情况,因此当前的准则是:
* 对于旧代码:
* 应将`$.data()`重构为`$.attr()`。
* 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
- 对于旧代码:
* 对于新代码:
* 不应使用`node.dataset`,而应使用`node.getAttribute`。
* 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
- 应将`$.data()`重构为`$.attr()`。
- 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
- 对于新代码:
- 不应使用`node.dataset`,而应使用`node.getAttribute`。
- 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
### 显示/隐藏元素
* 推荐在Vue组件中使用`v-if`和`v-show`来显示/隐藏元素。
* Go 模板代码应使用 `.tw-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
- 推荐在 Vue 组件中使用`v-if`和`v-show`来显示/隐藏元素。
- Go 模板代码应使用 `.tw-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
### Go HTML 模板中的样式和属性
建议使用以下方式:
```html
<div class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}" {{if .IsFoo}}data-foo{{end}}></div>
<div
class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}"
{{if
.IsFoo}}data-foo{{end}}
></div>
```
而不是:
```html
<div class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"{{if .IsFoo}} data-foo{{end}}></div>
<div
class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"
{{if
.IsFoo}}
data-foo{{end}}
></div>
```
以使代码更易读。
@@ -134,6 +144,6 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
Gitea 现在正在使用 Vue3。我们决定不引入 JSX,以保持 HTML 代码和 JavaScript 代码分离。
### UI示例
### UI 示例
Gitea 使用一些自制的 UI 元素并自定义其他元素,以将它们更好地集成到通用 UI 方法中。当在开发模式(`RUN_MODE=dev`)下运行 Gitea 时,在 `http(s)://your-gitea-url:port/devtest` 下会提供一个包含一些标准化 UI 示例的页面。
@@ -10,31 +10,31 @@ aliases:
## 背景
自2014年2月12日编写了第一行代码以来,Gitea已经发展成为一个庞大的项目。
自 2014 年 2 月 12 日编写了第一行代码以来,Gitea 已经发展成为一个庞大的项目。
因此,代码库变得越来越大。代码库越大,维护就越困难。
存在许多过时的机制,许多框架混合在一起,一些遗留代码可能会导致错误并阻碍新功能的开发。
为了使代码库更易于维护,使Gitea变得更好,开发人员应牢记使用现代机制来重构旧代码。
为了使代码库更易于维护,使 Gitea 变得更好,开发人员应牢记使用现代机制来重构旧代码。
本文档是关于重构代码库的指南集合。
## 重构建议
* 设计更多关于未来的内容,而不仅仅解决当前问题。
* 减少模糊性,减少冲突,提高可维护性。
* 描述重构,例如:
* 为什么需要重构。
* 如何解决旧问题。
* 重构的优点/缺点是什么。
* 只做必要的更改,尽量保留旧逻辑。
* 引入一些中间步骤,使重构更容易审查,完整的重构计划可以在几个PR中完成。
* 如果存在分歧,应该请TOC(技术监督委员会)参与决策。
* 添加必要的测试以确保重构的正确性。
* 非错误重构优先在里程碑的开始时进行,这样可以更容易地在发布之前发现问题。
- 设计更多关于未来的内容,而不仅仅解决当前问题。
- 减少模糊性,减少冲突,提高可维护性。
- 描述重构,例如:
- 为什么需要重构。
- 如何解决旧问题。
- 重构的优点/缺点是什么。
- 只做必要的更改,尽量保留旧逻辑。
- 引入一些中间步骤,使重构更容易审查,完整的重构计划可以在几个 PR 中完成。
- 如果存在分歧,应该请 TOC(技术监督委员会)参与决策。
- 添加必要的测试以确保重构的正确性。
- 非错误重构优先在里程碑的开始时进行,这样可以更容易地在发布之前发现问题。
## 审查和合并建议
* 重构的PR不应该长时间保持打开状态(通常为7天),应尽快进行审查。
* 重构的PR应尽快合并,不应被其他PR阻塞。
* 如果TOC没有异议,重构的PR可以在7天后由一名核心成员(非作者)批准后合并。
* 如果最终结果良好,容忍一些不完美/临时的步骤。
* 如果重构是必要的,容忍一些回归错误,并尽快修复错误。
- 重构的 PR 不应该长时间保持打开状态(通常为 7 天),应尽快进行审查。
- 重构的 PR 应尽快合并,不应被其他 PR 阻塞。
- 如果 TOC 没有异议,重构的 PR 可以在 7 天后由一名核心成员(非作者)批准后合并。
- 如果最终结果良好,容忍一些不完美/临时的步骤。
- 如果重构是必要的,容忍一些回归错误,并尽快修复错误。
@@ -8,9 +8,9 @@ aliases:
# 本地化
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
Gitea 的本地化是通过我们的[Crowdin 项目](https://crowdin.com/project/gitea)进行的。
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)中合适的关键字。
对于对**英语翻译**的更改,可以发出 pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)中合适的关键字。
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
@@ -16,7 +16,7 @@ aliases:
## 安装 Golang
您需要 [安装 go]( https://go.dev/doc/install ) 并设置您的 go 环境。
您需要 [安装 go](https://go.dev/doc/install) 并设置您的 go 环境。
接下来,[使用 npm 安装 Node.js](https://nodejs.org/en/download/) ,这是构建
JavaScript 和 CSS 文件的必要工具。最低支持的 Node.js 版本是 @minNodeVersion@
@@ -24,12 +24,12 @@ JavaScript 和 CSS 文件的必要工具。最低支持的 Node.js 版本是 @mi
**注意** :当执行需要外部工具的 make 任务时,比如
`make watch-backend`,Gitea 会自动下载并构建这些必要的组件。为了能够使用这些,你必须
将 `"$GOPATH"/bin` 目录加入到可执行路径上。如果你不把go bin目录添加到可执行路径你必须手动
将 `"$GOPATH"/bin` 目录加入到可执行路径上。如果你不把 go bin 目录添加到可执行路径你必须手动
指定可执行程序路径。
**注意2** :Go版本 @minGoVersion@ 或更高版本是必须的。Gitea 使用 `gofmt` 来
**注意 2** :Go 版本 @minGoVersion@ 或更高版本是必须的。Gitea 使用 `gofmt` 来
格式化源代码。然而,`gofmt` 的结果可能因 `go` 的版本而有差异。因此推荐安装我们持续集成使用
的 Go版本。截至上次更新,Go 版本应该是 @goVersion@。
的 Go 版本。截至上次更新,Go 版本应该是 @goVersion@。
## 安装 Make
@@ -55,15 +55,15 @@ sudo yum install make
Make 的这三个发行版都可以在 Windows 上运行:
- [单个二进制构建]( http://www.equation.com/servlet/equation.cmd?fa=make )。复制到某处并添加到 `PATH`。
- [单个二进制构建](http://www.equation.com/servlet/equation.cmd?fa=make)。复制到某处并添加到 `PATH`。
- [32 位版本](http://www.equation.com/ftpdir/make/32/make.exe)
- [64 位版本](http://www.equation.com/ftpdir/make/64/make.exe)
- [MinGW-w64](https://www.mingw-w64.org) / [MSYS2](https://www.msys2.org/)。
- MSYS2 是一个工具和库的集合,为您提供一个易于使用的环境来构建、安装和运行本机 Windows 软件,它包括 MinGW-w64。
- 在 MingGW-w64 中,二进制文件称为 `mingw32-make.exe` 而不是 `make.exe`。将 `bin` 文件夹添加到 `PATH`。
- 在 MSYS2 中,您可以直接使用 `make`。请参阅 [MSYS2 移植](https://www.msys2.org/wiki/Porting/)。
- 要使用 CGO_ENABLED(例如:SQLite3)编译 Gitea,您可能需要使用 [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) 而不是 MSYS2 gcc,因为 MSYS2 gcc 标头缺少一些 Windows -只有 CRT 函数像 _beginthread 一样。
- [Chocolatey包管理器]( https://chocolatey.org/packages/make )。运行`choco install make`
- 要使用 CGO_ENABLED(例如:SQLite3)编译 Gitea,您可能需要使用 [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) 而不是 MSYS2 gcc,因为 MSYS2 gcc 标头缺少一些 Windows -只有 CRT 函数像 \_beginthread 一样。
- [Chocolatey 包管理器](https://chocolatey.org/packages/make)。运行`choco install make`
**注意** :如果您尝试在 Windows 命令提示符下使用 make 进行构建,您可能会遇到问题。建议使用上述提示(Git bash 或 MinGW),但是如果您只有命令提示符(或可能是 PowerShell),则可以使用 [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) 命令,例如 `set TAGS=bindata`。
@@ -75,7 +75,7 @@ Make 的这三个发行版都可以在 Windows 上运行:
git clone https://github.com/go-gitea/gitea
```
(自从go modules出现后,不再需要构建 go 项目从 `$GOPATH` 中获取,因此不再推荐使用 `go get` 方法。)
(自从 go modules 出现后,不再需要构建 go 项目从 `$GOPATH` 中获取,因此不再推荐使用 `go get` 方法。)
## 派生 Gitea
@@ -196,7 +196,7 @@ SVG 图标是使用 `make svg` 命令构建的,该命令将图标资源编译
### 构建 Logo
Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images` 目标从单个 SVG 源文件 assets/logo.svg 构建的。要运行它,Node.js 和 npm 必须可用。
Gitea Logo 的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images` 目标从单个 SVG 源文件 assets/logo.svg 构建的。要运行它,Node.js 和 npm 必须可用。
通过更新 `assets/logo.svg` 并运行 `make generate-images`,同样的过程也可用于从 SVG 源文件生成自定义 Logo PNG。忽略 gitea 编译选项将仅更新用户指定的 LOGO 文件。
@@ -205,7 +205,7 @@ Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images`
创建新的 API 路由或修改现有的 API 路由时,您**必须**
更新和/或创建 [Swagger](https://swagger.io/docs/specification/2-0/what-is-swagger/)
这些使用 [go-swagger](https://goswagger.io/) 评论的文档。
[规范]( https://goswagger.io/use/spec.html#annotation-syntax )中描述了这些注释的结构。
[规范](https://goswagger.io/use/spec.html#annotation-syntax)中描述了这些注释的结构。
如果您想了解更多有关 Swagger 结构的信息,可以查看
[Swagger 2.0 文档](https://swagger.io/docs/specification/2-0/basic-structure/)
或与添加新 API 端点的先前 PR 进行比较,例如 [PR #5483](https://github.com/go-gitea/gitea/pull/5843/files#diff-2e0a7b644cf31e1c8ef7d76b444fe3aaR20)
@@ -239,7 +239,7 @@ make swagger-check
并到[配置备忘单](../administration/config-cheat-sheet.md)
在 `docs/content/doc/advanced/config-cheat-sheet.zh-cn.md` 中找到
### 更改Logo
### 更改 Logo
更改 Gitea Logo SVG 时,您将需要运行并提交结果的:
@@ -291,7 +291,7 @@ TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
我们的持续集成将测试代码是否通过了单元测试,并且所有支持的数据库都将在 Docker 环境中通过集成测试。
还将测试从几个最新版本的 Gitea 迁移。
请在PR中附带提交适当的单元测试和集成测试。
请在 PR 中附带提交适当的单元测试和集成测试。
## 网站文档
@@ -8,7 +8,7 @@ aliases:
# 集成
Gitea拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
Gitea 拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
我们正在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)上整理一个列表来跟踪这些集成!
@@ -8,24 +8,24 @@ aliases:
# 迁移接口
完整迁移功能在Gitea 1.9.0版本中引入。它定义了两个接口,用于支持从其他Git托管平台迁移存储库数据到Gitea,或者在将来将Gitea数据迁移到其他Git托管平台。
完整迁移功能在 Gitea 1.9.0 版本中引入。它定义了两个接口,用于支持从其他 Git 托管平台迁移存储库数据到 Gitea,或者在将来将 Gitea 数据迁移到其他 Git 托管平台。
目前已实现了从GitHub、GitLab和其他Gitea实例的迁移。
目前已实现了从 GitHub、GitLab 和其他 Gitea 实例的迁移。
首先,Gitea在包[modules/migration](https://github.com/go-gitea/gitea/tree/main/modules/migration)中定义了一些标准对象。它们是`Repository`、`Milestone`、`Release`、`ReleaseAsset`、`Label`、`Issue`、`Comment`、`PullRequest`、`Reaction`、`Review`、`ReviewComment`。
首先,Gitea 在包[modules/migration](https://github.com/go-gitea/gitea/tree/main/modules/migration)中定义了一些标准对象。它们是`Repository`、`Milestone`、`Release`、`ReleaseAsset`、`Label`、`Issue`、`Comment`、`PullRequest`、`Reaction`、`Review`、`ReviewComment`。
## 下载器接口
要从新的Git托管平台迁移,需要进行两个步骤的更新。
要从新的 Git 托管平台迁移,需要进行两个步骤的更新。
- 您应该实现一个`Downloader`,用于获取存储库信息。
- 您应该实现一个`DownloaderFactory`,用于检测URL是否匹配,并创建上述的`Downloader`。
- 您应该实现一个`DownloaderFactory`,用于检测 URL 是否匹配,并创建上述的`Downloader`。
- 您需要在`init()`中通过`RegisterDownloaderFactory`注册`DownloaderFactory`。
您可以在[downloader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/downloader.go)中找到这些接口。
## 上传器接口
目前,只实现了`GiteaLocalUploader`,因此我们只能通过此Uploader将下载的数据保存到本地的Gitea实例。目前不支持其他上传器。
目前,只实现了`GiteaLocalUploader`,因此我们只能通过此 Uploader 将下载的数据保存到本地的 Gitea 实例。目前不支持其他上传器。
您可以在[uploader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/uploader.go)中找到这些接口。
@@ -34,7 +34,7 @@ Gitea 支持作为 OAuth2 提供者,允许第三方应用程序在用户同意
Gitea 支持以下令牌范围:
| 名称 | 介绍 |
| ---- | ----------- |
| ---------------------------------------- | --------------------------------------------------------------- |
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
| **repo** | 完全控制所有存储库 |
| &nbsp;&nbsp;&nbsp; **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
@@ -12,90 +12,90 @@ aliases:
有关更多帮助资源,请查看所有[支持选项](help/support.md)。
## 1.x和1.x.x下载之间的区别
## 1.x 和 1.x.x 下载之间的区别
以1.7.x版本为例。
以 1.7.x 版本为例。
**注意:**此示例也适用于Docker镜像!
**注意:**此示例也适用于 Docker 镜像!
在我们的[下载页面](https://dl.gitea.com/gitea/)上,您会看到一个1.7目录,以及1.7.0、1.7.1、1.7.2、1.7.3、1.7.4、1.7.5和1.7.6的目录。
在我们的[下载页面](https://dl.gitea.com/gitea/)上,您会看到一个 1.7 目录,以及 1.7.0、1.7.1、1.7.2、1.7.3、1.7.4、1.7.5 和 1.7.6 的目录。
1.7目录和1.7.0目录是**不同**的。1.7目录是在每个合并到[`release/v1.7`](https://github.com/go-gitea/gitea/tree/release/v1.7)分支的提交上构建的。
1.7 目录和 1.7.0 目录是**不同**的。1.7 目录是在每个合并到[`release/v1.7`](https://github.com/go-gitea/gitea/tree/release/v1.7)分支的提交上构建的。
然而,1.7.0目录是在创建[`v1.7.0`](https://github.com/go-gitea/gitea/releases/tag/v1.7.0)标签时创建的构建。
然而,1.7.0 目录是在创建[`v1.7.0`](https://github.com/go-gitea/gitea/releases/tag/v1.7.0)标签时创建的构建。
这意味着1.x的下载会随着提交合并到各自的分支而改变(将其视为每个版本的单独的“main”分支)。
这意味着 1.x 的下载会随着提交合并到各自的分支而改变(将其视为每个版本的单独的“main”分支)。
另一方面,1.x.x的下载应该永远不会改变。
另一方面,1.x.x 的下载应该永远不会改变。
## 如何从Gogs/GitHub等迁移到Gitea
## 如何从 Gogs/GitHub 等迁移到 Gitea
要从Gogs迁移到Gitea:
要从 Gogs 迁移到 Gitea:
- [Gogs版本0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
- [Gogs 版本 0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
要从GitHub迁移到Gitea,您可以使用Gitea内置的迁移表单。
要从 GitHub 迁移到 Gitea,您可以使用 Gitea 内置的迁移表单。
为了迁移诸如问题、拉取请求等项目,您需要至少输入您的用户名。
[Example (requires login)](https://demo.gitea.com/repo/migrate)
要从GitLab迁移到Gitea,您可以使用这个非关联的工具:
要从 GitLab 迁移到 Gitea,您可以使用这个非关联的工具:
https://github.com/loganinak/MigrateGitlabToGogs
## Gitea存储文件的位置
## Gitea 存储文件的位置
- _`AppWorkPath`_
- `--work-path`标志
- 或者环境变量`GITEA_WORK_DIR`
- 或者在构建时设置的内置值
- 或者包含Gitea二进制文件的目录
- 或者包含 Gitea 二进制文件的目录
- `%(APP_DATA_PATH)`(数据库、索引器等的默认路径)
- `app.ini`中的`APP_DATA_PATH`
- 或者_`AppWorkPath`_`/data`
- 或者*`AppWorkPath`*`/data`
- _`CustomPath`_(自定义模板)
- `--custom-path`标志
- 或者环境变量`GITEA_CUSTOM`
- 或者在构建时设置的内置值
- 或者_`AppWorkPath`_`/custom`
- 或者*`AppWorkPath`*`/custom`
- HomeDir
- Unix:环境变量`HOME`
- Windows:环境变量`USERPROFILE`,或者环境变量`HOMEDRIVE`+`HOMEPATH`
- RepoRootPath
- `app.ini`中\[repository]部分的`ROOT`(如果是绝对路径)
- 否则_`AppWorkPath`_`/ROOT`(如果`app.ini`中\[repository]部分的`ROOT`是相对路径)
- 否则*`AppWorkPath`*`/ROOT`(如果`app.ini`中\[repository]部分的`ROOT`是相对路径)
- 默认值为`%(APP_DATA_PATH)/gitea-repositories`
- INI(配置文件)
- `--config`标志
- 或者在构建时设置的可能内置值
- 或者 _`CustomPath`_`/conf/app.ini`
- SQLite数据库
- app.ini中database部分的PATH
- SQLite 数据库
- app.ini 中 database 部分的 PATH
- 或者`%(APP_DATA_PATH)/gitea.db`
## 看不到克隆URL或克隆URL不正确
## 看不到克隆 URL 或克隆 URL 不正确
有几个地方可能会导致显示不正确。
1. 如果使用反向代理,请确保按照[反向代理指南](../administration/reverse-proxies.md)中的正确说明进行设置。
2. 确保在`app.ini`的`server`部分中正确设置了`ROOT_URL`。
如果某些克隆选项未显示(HTTP/S或SSH),可以在`app.ini中`
如果某些克隆选项未显示(HTTP/S 或 SSH),可以在`app.ini中`
- `DISABLE_HTTP_GIT`: 如果设为true, 将会没有HTTP/HTTPS链接
- `DISABLE_SSH`: 如果设为true, 将会没有SSH链接
- `SSH_EXPOSE_ANONYMOUS`: 如果设为false, SSH链接将会对匿名用户隐藏
- `DISABLE_HTTP_GIT`: 如果设为 true, 将会没有 HTTP/HTTPS 链接
- `DISABLE_SSH`: 如果设为 true, 将会没有 SSH 链接
- `SSH_EXPOSE_ANONYMOUS`: 如果设为 false, SSH 链接将会对匿名用户隐藏
## 文件上传失败:413 Request Entity Too Large
当反向代理限制文件上传大小时,会出现此错误。
有关使用nginx解决此问题,请参阅[反向代理指南](../administration/reverse-proxies.md)。
有关使用 nginx 解决此问题,请参阅[反向代理指南](../administration/reverse-proxies.md)。
## 自定义模板无法加载或运行错误
Gitea的自定义模板必须将其添加到正确的位置,否则Gitea将无法找到并使用自定义模板。
Gitea 的自定义模板必须将其添加到正确的位置,否则 Gitea 将无法找到并使用自定义模板。
模板的正确路径应该相对于`CustomPath`。
@@ -104,35 +104,35 @@ Gitea的自定义模板必须将其添加到正确的位置,否则Gitea将无
如果找不到,请尝试`echo $GITEA_CUSTOM`。
2. 如果仍然找不到,默认值可以被[计算](faq.md#Gitea存储文件的位置)
3. 如果仍然找不到路径,则可以参考[自定义Gitea](../administration/customizing-gitea.md)页面,将模板添加到正确的位置。
3. 如果仍然找不到路径,则可以参考[自定义 Gitea](../administration/customizing-gitea.md)页面,将模板添加到正确的位置。
## Gitea是否有"GitHub/GitLab Pages"功能?
## Gitea 是否有"GitHub/GitLab Pages"功能?
Gitea不提供内置的Pages服务器。您需要一个专用的域名来提供静态页面,以避免CSRF安全风险。
Gitea 不提供内置的 Pages 服务器。您需要一个专用的域名来提供静态页面,以避免 CSRF 安全风险。
对于简单的用法,您可以使用反向代理来重写和提供Gitea的原始文件URL中的静态内容。
对于简单的用法,您可以使用反向代理来重写和提供 Gitea 的原始文件 URL 中的静态内容。
还有一些已经可用的第三方服务,比如独立[pages server](https://codeberg.org/Codeberg/pages-server)的或[caddy plugin](https://github.com/42wim/caddy-gitea),可以提供所需的功能。
## 活跃用户与禁止登录用户
在Gitea中,"活跃用户"是指通过电子邮件激活其帐户的用户。
在 Gitea 中,"活跃用户"是指通过电子邮件激活其帐户的用户。
"禁止登录用户"是指不允许再登录到Gitea的用户。
"禁止登录用户"是指不允许再登录到 Gitea 的用户。
## 设置日志记录
- [官方文档](../administration/logging-config.md)
## 什么是Swagger?
## 什么是 Swagger?
[Swagger](https://swagger.io/) 是Gitea用于其API文档的工具。
[Swagger](https://swagger.io/) 是 Gitea 用于其 API 文档的工具。
所有Gitea实例都有内置的API,无法完全禁用它。
但是,您可以在app.ini的api部分将ENABLE_SWAGGER设置为false,以禁用其文档显示。
有关更多信息,请参阅Gitea的[API文档](development/api-usage.md)。
所有 Gitea 实例都有内置的 API,无法完全禁用它。
但是,您可以在 app.ini 的 api 部分将 ENABLE_SWAGGER 设置为 false,以禁用其文档显示。
有关更多信息,请参阅 Gitea 的[API 文档](development/api-usage.md)。
您可以在上查看最新的API(例如)https://gitea.com/api/swagger
您可以在上查看最新的 API(例如)https://gitea.com/api/swagger
您还可以在上查看`swagger.json`文件的示例 https://gitea.com/swagger.v1.json
@@ -143,7 +143,7 @@ Gitea不提供内置的Pages服务器。您需要一个专用的域名来提供
有多种方法可以组合使用来防止垃圾邮件发送者:
1. 通过设置电子邮件域名的白名单或黑名单。
2. 通过设置一些域名或者OpenID白名单(见下文)。
2. 通过设置一些域名或者 OpenID 白名单(见下文)。
3. 在您的`app.ini`中将`ENABLE_CAPTCHA`设置为`true`,并正确配置`RECAPTCHA_SECRET`和 `RECAPTCHA_SITEKEY`。
4. 将`DISABLE_REGISTRATION`设置为`true`,并通过 [CLI](../administration/command-line.md)、[API](development/api-usage.md) 或 Gitea 的管理界面创建新用户。
@@ -173,13 +173,13 @@ Gitea不提供内置的Pages服务器。您需要一个专用的域名来提供
使用 [Fail2Ban](../administration/fail2ban-setup.md) 监视并阻止基于日志模式的自动登录尝试或其他恶意行为。
## SSHD vs 内建SSH
## SSHD vs 内建 SSH
SSHD是大多数Unix系统上内建的SSH服务器。
SSHD 是大多数 Unix 系统上内建的 SSH 服务器。
Gitea还提供了自己的SSH服务器,用于在SSHD不可用时使用。
Gitea 还提供了自己的 SSH 服务器,用于在 SSHD 不可用时使用。
## Gitea运行缓慢
## Gitea 运行缓慢
导致此问题的最常见原因是加载联合头像。
@@ -189,21 +189,21 @@ Gitea还提供了自己的SSH服务器,用于在SSHD不可用时使用。
## 无法创建仓库/文件
请确保Gitea具有足够的权限来写入其主目录和数据目录。
请确保 Gitea 具有足够的权限来写入其主目录和数据目录。
参见[AppDataPath 和 RepoRootPath](faq.md#Gitea存储文件的位置)
**适用于Arch用户的注意事项:**在撰写本文时,Arch软件包的systemd文件包含了以下行:
**适用于 Arch 用户的注意事项:**在撰写本文时,Arch 软件包的 systemd 文件包含了以下行:
`ReadWritePaths=/etc/gitea/app.ini`
这将使得Gitea无法写入其他路径。
这将使得 Gitea 无法写入其他路径。
## 翻译不正确/如何添加更多翻译
我们当前的翻译是在我们的[Crowdin项目](https://crowdin.com/project/gitea)上众包进行的
我们当前的翻译是在我们的[Crowdin 项目](https://crowdin.com/project/gitea)上众包进行的
无论您想要更改翻译还是添加新的翻译,都需要在Crowdin集成中进行,因为所有翻译都会被CI覆盖。
无论您想要更改翻译还是添加新的翻译,都需要在 Crowdin 集成中进行,因为所有翻译都会被 CI 覆盖。
## 推送钩子/ Webhook / Actions 未运行
@@ -211,15 +211,15 @@ Gitea还提供了自己的SSH服务器,用于在SSHD不可用时使用。
这可能是由于以下原因:
1. Git钩子不同步:在站点管理面板上运行“重新同步所有仓库的pre-receive、update和post-receive钩子”
2. Git仓库(和钩子)存储在一些不支持脚本执行的文件系统上(例如由NAS挂载),请确保文件系统支持`chmod a+x any-script`
3. 如果您使用的是Docker,请确保Docker Server(而不是客户端)的版本 >= 20.10.6
1. Git 钩子不同步:在站点管理面板上运行“重新同步所有仓库的 pre-receive、update 和 post-receive 钩子”
2. Git 仓库(和钩子)存储在一些不支持脚本执行的文件系统上(例如由 NAS 挂载),请确保文件系统支持`chmod a+x any-script`
3. 如果您使用的是 Docker,请确保 Docker Server(而不是客户端)的版本 >= 20.10.6
## SSH问题
## SSH 问题
如果无法通过`ssh`访问仓库,但`https`正常工作,请考虑以下情况。
首先,请确保您可以通过SSH访问Gitea。
首先,请确保您可以通过 SSH 访问 Gitea。
`ssh [email protected]`
@@ -247,16 +247,18 @@ fatal: Could not read from remote repository.
- 在客户端:
- 确保公钥和私钥已添加到正确的 Gitea 用户。
- 确保远程 URL 中没有任何问题。特别是,请确保∂
- 确保远程 URL 中没有任何问题。特别是,请确保 ∂
Git 用户(@ 之前的部分)的名称拼写正确。
- 确保客户端机器上的公钥和私钥正确无误。
- 在服务器上:
- 确保存储库存在并且命名正确。
- 检查系统用户主目录中的 `.ssh` 目录的权限。
- 验证正确的公钥是否已添加到 `.ssh/authorized_keys` 中。
尝试在 Gitea 管理面板上运行
`Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)`。
- 查看 Gitea 日志。
- 查看 /var/log/auth(或类似的文件)。
- 检查存储库的权限。
@@ -328,7 +330,9 @@ Gitea 提供了一个子命令`gitea migrate`来初始化数据库,然后您
- 使用[管理 CLI 命令](../administration/command-line.md#admin)。
请注意,大多数命令还需要一个[全局标志](../administration/command-line.md#全局选项)来指向正确的配置。
- 作为**用户**,您可以更改密码...
- 在您的账户的`设置 -> 账户`页面(此方法**需要**您知道当前密码)。
- 使用`忘记密码`链接。
@@ -338,7 +342,7 @@ Gitea 提供了一个子命令`gitea migrate`来初始化数据库,然后您
在 Gitea 版本 `1.11` 中,我们转换为使用[goldmark](https://github.com/yuin/goldmark)进行 Markdown 渲染,它符合[CommonMark](https://commonmark.org/)标准。
如果您在版本`1.11`之前的Markdown正常工作,但在升级后无法正常工作,请仔细阅读CommonMark规范,看看问题是由错误还是非兼容的语法引起的。
如果您在版本`1.11`之前的 Markdown 正常工作,但在升级后无法正常工作,请仔细阅读 CommonMark 规范,看看问题是由错误还是非兼容的语法引起的。
如果是后者,通常规范中会列出一种符合标准的替代方法。
@@ -65,5 +65,5 @@ Gitea 可以使用 Golang 的 pprof 处理程序和工具链来收集堆栈跟
2. 重新启动 Gitea
3. 尝试触发bug,当请求卡住一段时间,使用或浏览器访问:获取堆栈跟踪。
`curl http://127.0.0.1:6060/debug/pprof/goroutine?debug=1`
3. 尝试触发 bug,当请求卡住一段时间,使用或浏览器访问:获取堆栈跟踪。
`curl http://127.0.0.1:6060/debug/pprof/goroutine?debug=1`
@@ -14,18 +14,18 @@ aliases:
_表格中的符号含义:_
* _✓ - 支持_
- _✓ - 支持_
* _⁄ - 部分支持_
- _⁄ - 部分支持_
* _✘ - 不支持_
- _✘ - 不支持_
* _⚙️ - 由第三方服务或插件支持_
- _⚙️ - 由第三方服务或插件支持_
#### 主要特性
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| ------------------------------- | -------------------------------------------------- | ---- | --------- | --------- | --------- | -------------- | ------------ |
| -------------------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | -------------- | ------------ |
| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ |
| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ |
| 支持多种数据库 | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ |
@@ -50,13 +50,13 @@ _表格中的符号含义:_
| 内置 CI/CD | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 子组织:组织内的组织 | [✘](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 多实例交互 | [/](https://github.com/go-gitea/gitea/issues/18240) | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
| Markdown绘图 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Markdown数学公式 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Markdown 绘图 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Markdown 数学公式 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
#### 代码管理
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| ------------------------------------ | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ |
| -------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ |
| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
@@ -187,7 +187,7 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
- `/path/to/postgresql.crt`: 数据库实例证书
- `/path/to/postgresql.key`: 数据库实例私钥
- `/path/to/root.crt`: 用于验证客户端证书的CA证书链
- `/path/to/root.crt`: 用于验证客户端证书的 CA 证书链
2. 在 `postgresql.conf` 中添加以下选项:
@@ -206,15 +206,15 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
chmod 0600 /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
```
4. 编辑 `pg_hba.conf` 规则,仅允许 Gitea 数据库用户通过SSL连接,并要求客户端证书验证。
4. 编辑 `pg_hba.conf` 规则,仅允许 Gitea 数据库用户通过 SSL 连接,并要求客户端证书验证。
对于PostgreSQL 12:
对于 PostgreSQL 12:
```ini
hostssl giteadb gitea 192.0.2.10/32 scram-sha-256 clientcert=verify-full
```
对于PostgreSQL 11及更早版本:
对于 PostgreSQL 11 及更早版本:
```ini
hostssl giteadb gitea 192.0.2.10/32 scram-sha-256 clientcert=1
@@ -228,7 +228,7 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
- `~/.postgresql/postgresql.crt`: 数据库客户端证书
- `~/.postgresql/postgresql.key`: 数据库客户端私钥
- `~/.postgresql/root.crt`: 用于验证服务器证书的CA证书链
- `~/.postgresql/root.crt`: 用于验证服务器证书的 CA 证书链
注意:上述文件名在 PostgreSQL 中是硬编码的,无法更改。
@@ -249,15 +249,15 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
### MySQL/MariaDB TLS
虽然 Gitea 使用的MySQL驱动程序也支持双向 TLS,但目前 Gitea 仅支持单向 TLS。有关详细信息,请参见工单#10828。
虽然 Gitea 使用的 MySQL 驱动程序也支持双向 TLS,但目前 Gitea 仅支持单向 TLS。有关详细信息,请参见工单#10828。
在单向TLS中,数据库客户端在连接握手期间验证服务器发送的证书,而服务器则假定连接的客户端是合法的,因为不进行客户端证书验证。
在单向 TLS 中,数据库客户端在连接握手期间验证服务器发送的证书,而服务器则假定连接的客户端是合法的,因为不进行客户端证书验证。
1. 在数据库实例上放置以下凭据:
- `/path/to/mysql.crt`: 数据库实例证书
- `/path/to/mysql.key`: 数据库实例密钥
- `/path/to/ca.crt`: CA证书链。在单向TLS中不使用此文件,但用于验证双向TLS中的客户端证书。
- `/path/to/ca.crt`: CA 证书链。在单向 TLS 中不使用此文件,但用于验证双向 TLS 中的客户端证书。
2. 将以下选项添加到 `my.cnf`:
@@ -276,7 +276,7 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
chmod 0600 /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
```
4. 重新启动MySQL以应用设置。
4. 重新启动 MySQL 以应用设置。
5. Gitea 的数据库用户可能已经创建过,但只会对运行 Gitea 的服务器的 IP 地址进行身份验证。要对其域名进行身份验证,请重新创建用户,并设置其需要通过 TLS 连接到数据库:
@@ -289,9 +289,9 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
根据需要替换数据库用户名、密码和 Gitea 实例域名。
6. 确保用于验证数据库服务器证书的CA证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
6. 确保用于验证数据库服务器证书的 CA 证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
7. 在运行Gitea的服务器上,测试与数据库的连接:
7. 在运行 Gitea 的服务器上,测试与数据库的连接:
```
mysql -u gitea -h example.db -p --ssl
Loaded 50 of 1181 files, more files were not shown because too many files have changed in this diff. Show more