139 Commits
v1.22 ... v1.24

Author SHA1 Message Date
Snowball_233
d5eac4f23d chore(docker-compose): remove obsolete version parament & remove useless default external=false (#288)
- Removed deprecated `version` key from docker-compose.yaml
- Cleaned up unnecessary `external: false` declarations for networks/volumes

Signed-off-by: Snowball_233 <snowballxueqiu@noreply.gitea.com>

Reviewed-on: https://gitea.com/gitea/docs/pulls/288
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: Snowball_233 <snowballxueqiu@noreply.gitea.com>
Co-committed-by: Snowball_233 <snowballxueqiu@noreply.gitea.com>
2025-10-30 14:07:06 +00:00
drabart
f954c6e7b8 Fix typo in CAD preview supported extensions list (#286) (#287)
Fixes small typo that caused copied code to not work.

Reviewed-on: https://gitea.com/gitea/docs/pulls/287
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: drabart <drabart@noreply.gitea.com>
Co-committed-by: drabart <drabart@noreply.gitea.com>
2025-10-28 01:40:09 +00:00
Lunny Xiao
cf9b8dce28 uprade 1.24.7 2025-10-25 21:03:20 -07:00
wxiaoguang
12293b604e Update docs/administration/config-cheat-sheet.md (#285)
Reviewed-on: https://gitea.com/gitea/docs/pulls/285
2025-10-25 03:47:14 +00:00
dangjinghao
bb7b7fe5bf Add frontmatter and TOC rendering support for markdown files (#284)
<https://github.com/go-gitea/gitea/issues/14411#issuecomment-764871702>

Reviewed-on: https://gitea.com/gitea/docs/pulls/284
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: dangjinghao <dangjinghaoemail@163.com>
Co-committed-by: dangjinghao <dangjinghaoemail@163.com>
2025-10-23 17:55:14 +00:00
juls0730
b6af199508 Clarify Setting up a push mirror from Gitea to GitHub in repo mirror docs (#275)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/275
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: juls0730 <juls0730@noreply.gitea.com>
Co-committed-by: juls0730 <juls0730@noreply.gitea.com>
2025-10-16 22:09:44 +00:00
Renovate Bot
dedfbf1f27 chore(deps): update dependency cross-env to v10.1.0 (#277)
Reviewed-on: https://gitea.com/gitea/docs/pulls/277
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-10-16 14:53:32 +00:00
Renovate Bot
f9ff323873 fix(deps): update dependency @mui/material to v7.3.4 (#278)
Reviewed-on: https://gitea.com/gitea/docs/pulls/278
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-10-16 14:51:56 +00:00
Renovate Bot
1046625638 fix(deps): update react monorepo to v19.2.0 (#279)
Reviewed-on: https://gitea.com/gitea/docs/pulls/279
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-10-16 14:50:44 +00:00
Renovate Bot
200479a1a3 chore(deps): update actions/setup-node action to v6 (#282)
Reviewed-on: https://gitea.com/gitea/docs/pulls/282
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-10-16 14:44:29 +00:00
DiegoBM
bd38456e4b Fix home reference (#281)
~ points to the logged user's home, not to /home

Co-authored-by: Diego de Blas Mateo <1613216+DiegoBM@users.noreply.github.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/281
Reviewed-by: TheFox0x7 <thefox0x7@noreply.gitea.com>
Co-authored-by: DiegoBM <diegobm@noreply.gitea.com>
Co-committed-by: DiegoBM <diegobm@noreply.gitea.com>
2025-10-16 14:43:55 +00:00
vincentkersten
3578007c38 Update docs/administration/reverse-proxies.md (#280)
Using a full certificate chain will prevent errors from using git directly on the URL to be pulled/cloned.
 (Error: 'fatal: unable to access 'https://git.example.net/git/sarah/test.git': server certificate verification failed. CAfile: none CRLfile: none')

Reviewed-on: https://gitea.com/gitea/docs/pulls/280
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: vincentkersten <vincentkersten@noreply.gitea.com>
Co-committed-by: vincentkersten <vincentkersten@noreply.gitea.com>
2025-10-08 16:30:48 +00:00
johny-mnemonic
c586a396b8 Add Nginx Proxy Manager instructions (#274)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/274
Co-authored-by: johny-mnemonic <johny-mnemonic@noreply.gitea.com>
Co-committed-by: johny-mnemonic <johny-mnemonic@noreply.gitea.com>
2025-09-15 03:09:06 +00:00
Lunny Xiao
de6d4374b0 Upgrade to 1.24.6 2025-09-11 20:20:46 -07:00
Johan Van de Wauw
c9bf137a23 Add TWO_FACTOR_AUTH documentation (#273)
Reviewed-on: https://gitea.com/gitea/docs/pulls/273
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Johan Van de Wauw <johanvdw@noreply.gitea.com>
Co-committed-by: Johan Van de Wauw <johanvdw@noreply.gitea.com>
2025-09-10 20:48:36 +00:00
Renovate Bot
83da675c59 chore(deps): update actions/setup-node action to v5 (#270)
Reviewed-on: https://gitea.com/gitea/docs/pulls/270
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-09-07 11:11:18 +00:00
Renovate Bot
135f34d09a chore(deps): update aws-actions/configure-aws-credentials action to v5 (#271)
Reviewed-on: https://gitea.com/gitea/docs/pulls/271
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-09-07 11:11:07 +00:00
baikuarch
3eda094305 更新 i18n/zh-cn/docusaurus-plugin-content-docs/current/administration/backup-and-restore.md (#272)
Reviewed-on: https://gitea.com/gitea/docs/pulls/272
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: baikuarch <baikuarch@sina.com>
Co-committed-by: baikuarch <baikuarch@sina.com>
2025-09-06 00:57:20 +00:00
Renovate Bot
312cbc2a6e fix(deps): update dependency @mdx-js/react to v3.1.1 (#267)
Reviewed-on: https://gitea.com/gitea/docs/pulls/267
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-09-03 21:01:10 +00:00
Renovate Bot
4164f4df06 fix(deps): update dependency @mui/material to v7.3.2 (#268)
Reviewed-on: https://gitea.com/gitea/docs/pulls/268
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-09-03 21:00:45 +00:00
ifurther
cb462089e9 docs: update zh-tw (#265)
Reviewed-on: https://gitea.com/gitea/docs/pulls/265
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ifurther <55025025+ifurther@users.noreply.github.com>
Co-committed-by: ifurther <55025025+ifurther@users.noreply.github.com>
2025-09-03 21:00:35 +00:00
desysoft
908a27589d Update versioned_docs/version-1.24/development/api-usage.md (#269)
Fix JSON syntax error in token creation request

The previous JSON was malformed:

{"name":test_token","scopes":[...]}

The value of "name" was missing opening quotes, causing the error:
invalid character 't' looking for beginning of value

Fixed by enclosing the string in double quotes:

{"name":"test_token","scopes":[...]}

Reviewed-on: https://gitea.com/gitea/docs/pulls/269
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: desysoft <desysoft@noreply.gitea.com>
Co-committed-by: desysoft <desysoft@noreply.gitea.com>
2025-09-03 21:00:09 +00:00
Renovate Bot
6b64b97e3b chore(deps): update actions/checkout action to v5 (#261)
Reviewed-on: https://gitea.com/gitea/docs/pulls/261
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-09-01 01:38:35 +00:00
Renovate Bot
90ab1c20c2 fix(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.52.0 (#230)
Reviewed-on: https://gitea.com/gitea/docs/pulls/230
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-08-29 18:47:35 +00:00
Renovate Bot
d61eaecbb1 fix(deps): update docusaurus monorepo to v3.8.1 (#225)
Reviewed-on: https://gitea.com/gitea/docs/pulls/225
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-08-27 16:12:37 +00:00
Renovate Bot
b30993162c fix(deps): update dependency @mui/material to v7.3.1 (#242)
Reviewed-on: https://gitea.com/gitea/docs/pulls/242
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-08-27 16:11:50 +00:00
Renovate Bot
004bebe6b4 fix(deps): update react monorepo to v19.1.1 (#254)
Reviewed-on: https://gitea.com/gitea/docs/pulls/254
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-08-27 16:11:08 +00:00
techknowlogick
ed59125e25 Enable v4 future 2025-08-27 16:10:19 +00:00
Lunny Xiao
c699d12a55 upgrade to 1.24.5 2025-08-14 18:52:32 -07:00
kmanwar89
4d5fd1f6fb Clarified GPG signature validation instructions to be more clear (#262)
Added instructions on how to download the signature file using wget, and fixed a typo in the wget commands that would have caused the command to fail when copied/pasted.

Reviewed-on: https://gitea.com/gitea/docs/pulls/262
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: kmanwar89 <kmanwar89@noreply.gitea.com>
Co-committed-by: kmanwar89 <kmanwar89@noreply.gitea.com>
2025-08-14 21:51:45 +00:00
Lunny Xiao
c13d82ccc3 Update gpg check command to use hkps by default (#260)
Fix #255

Reviewed-on: https://gitea.com/gitea/docs/pulls/260
2025-08-12 16:57:24 +00:00
nero-dv
0552f4523c Update versioned_docs/version-1.24/installation/from-binary.md (#259)
The main branch is missing the directory where the autocompletion scripts were in. Version 1.24 does still have the scripts, so linked directly to them.

Reviewed-on: https://gitea.com/gitea/docs/pulls/259
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: nero-dv <nero-dv@noreply.gitea.com>
Co-committed-by: nero-dv <nero-dv@noreply.gitea.com>
2025-08-08 21:55:21 +00:00
Lunny Xiao
03c98878cf upgrade to 1.24.4 2025-08-04 17:00:13 -07:00
Christopher Homberger
cf33eee47f Initial Ephemeral Runners Documentation (#239)
Document this feature for 1.24 onwards.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/239
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
2025-07-28 20:40:59 +00:00
Christopher Homberger
201f0f3ef8 Document workflow_dispatch workflow_run (#238)
Document missing workflow triggers of 1.23..1.25-dev

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/238
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
2025-07-28 20:39:01 +00:00
Christopher Homberger
e8a6c4281d Add ssh commit signing to docs of 1.25-dev (#241)
Documentation for my changes to ssh commit signing in <https://github.com/go-gitea/gitea/pull/34341>.

* Renames "GPG Commit Signatures" to "GPG/SSH Commit Signatures", since the url is called just signing and creating a new page would duplicate a lot
* _"The default option and repository specific signing keys are not supported for ssh keys"_
   * the original draft implementation did support this for ssh keys
   * this warning should avoid people expecting this gitconfig style things to work for ssh keys, since verifying is disabled in this case (e.g. pre 1.25 undocumented behavior preserved).

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/241
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
2025-07-28 20:37:52 +00:00
Karthik-Bhandary
641977c93a Updated the docs and versioned_docs (#253)
This closes #251

Co-authored-by: karthik.bhandary <karthik.bhandary@kfintech.com>
Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/253
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: Karthik-Bhandary <karthik-bhandary@noreply.gitea.com>
Co-committed-by: Karthik-Bhandary <karthik-bhandary@noreply.gitea.com>
2025-07-28 19:46:12 +00:00
Renovate Bot
fbd73fd263 chore(deps): update dependency cross-env to v10 (#250)
Reviewed-on: https://gitea.com/gitea/docs/pulls/250
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-07-28 19:45:22 +00:00
dr-1
a6fc8044b0 Make language adjustments on index page (#244)
Some minor adjustments on the landing page.

- Fix grammatical errors
- Fix a capitalization error and inconsistent capitalization in a heading
- Remove a redundant sentence

Co-authored-by: Dominik Rubo <dominik.rubo@posteo.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/244
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: dr-1 <dr-1@noreply.gitea.com>
Co-committed-by: dr-1 <dr-1@noreply.gitea.com>
2025-07-18 03:18:05 +00:00
ChristopherHX
fa11851d67 Fix formatting of email setup (#249)
Sorry I incorrectly used the :::note syntax in one PR merged recently, missing `:::` to end the quote

CC @lunny

Picture of the bug I introduced appended.

Reviewed-on: https://gitea.com/gitea/docs/pulls/249
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-committed-by: ChristopherHX <christopher.homberger@web.de>
2025-07-18 03:10:58 +00:00
ChristopherHX
f9ff184ee3 Mention smtp+starttls not only in the config cheat sheet (#247)
I almost entered STARTTLS under PROTOCOLS, better to mention the correct solution without needing to check the config cheat sheet.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/247
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-committed-by: ChristopherHX <christopher.homberger@web.de>
2025-07-16 17:48:45 +00:00
ChristopherHX
cbbf31f1d5 Provide a hint for ENABLE_NOTIFY_MAIL in email setup (#246)
* some people like me might wonder why the email-setup didn't work

While reviewing https://github.com/go-gitea/gitea/pull/34982#pullrequestreview-3013995449, I enabled the mailer the first time and found this solution in the debugger not in the docs.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/246
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-committed-by: ChristopherHX <christopher.homberger@web.de>
2025-07-16 17:48:12 +00:00
Lunny Xiao
47594bba97 upgrade gitea to 1.24.3 2025-07-15 09:44:13 -07:00
Renovate Bot
63c75a97c6 fix(deps): update dependency @emotion/styled to v11.14.1 (#240)
Reviewed-on: https://gitea.com/gitea/docs/pulls/240
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-06-30 16:06:46 +00:00
Renovate Bot
50aad0431b fix(deps): update dependency @mui/material to v7.1.2 (#233)
Reviewed-on: https://gitea.com/gitea/docs/pulls/233
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-06-30 16:06:40 +00:00
paultibbetts
164f1c837f Update URL for Caddy reverse proxy HTTPS guide (#236)
Reviewed-on: https://gitea.com/gitea/docs/pulls/236
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: paultibbetts <paultibbetts@noreply.gitea.com>
Co-committed-by: paultibbetts <paultibbetts@noreply.gitea.com>
2025-06-25 14:17:33 +00:00
Lunny Xiao
870f30e886 upgrade to 1.24.2 2025-06-21 10:13:34 -07:00
Lunny Xiao
33ec7a49df upgrade to 1.24.1 2025-06-19 15:31:41 -07:00
gnscc
bc606bd422 Fix typo in api-usage.md (#232)
Fix breaking typo in api-usage.

Reviewed-on: https://gitea.com/gitea/docs/pulls/232
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: gnscc <gnscc@noreply.gitea.com>
Co-committed-by: gnscc <gnscc@noreply.gitea.com>
2025-06-17 19:38:09 +00:00
recoolcz
3a82ab51f3 bugfix: Fix O3DV script since it broke in 1.24.0 (#231)
Reviewed-on: https://gitea.com/gitea/docs/pulls/231
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: recoolcz <recoolcz@noreply.gitea.com>
Co-committed-by: recoolcz <recoolcz@noreply.gitea.com>
2025-06-16 17:10:30 +00:00
Lunny Xiao
c8ebd4e896 Fix latest stable version 2025-06-10 15:46:23 -07:00
techknowlogick
a320f53087 1.24.0 2025-06-10 15:21:23 +00:00
Renovate Bot
95544e7847 fix(deps): update dependency @mui/material to v7.1.1 (#228)
Reviewed-on: https://gitea.com/gitea/docs/pulls/228
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-06-10 15:20:44 +00:00
Renovate Bot
af373024a0 fix(deps): update dependency @easyops-cn/docusaurus-search-local to ^0.50.0 (#229)
Reviewed-on: https://gitea.com/gitea/docs/pulls/229
Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-06-10 15:19:21 +00:00
techknowlogick
57ed041528 bump to 1.24.0 2025-06-10 15:08:01 +00:00
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 <xiaolunwen@gmail.com>
Co-authored-by: recoolcz <recoolcz@noreply.gitea.com>
Co-committed-by: recoolcz <recoolcz@noreply.gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <schallbert@mailbox.org>
Co-committed-by: Schallbert <schallbert@mailbox.org>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: dmitri.karpovich <dmitri.karpovich@noreply.gitea.com>
Co-committed-by: dmitri.karpovich <dmitri.karpovich@noreply.gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 Bryant
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 <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/216
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Kerwin Bryant <kerwin612@qq.com>
Co-committed-by: Kerwin Bryant <kerwin612@qq.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@noreply.gitea.com>
Co-committed-by: wxiaoguang <wxiaoguang@noreply.gitea.com>
2025-04-21 23:10:45 +00:00
Rowan Bohde
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 <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/208
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Rowan Bohde <rowan@allspice.io>
Co-committed-by: Rowan Bohde <rowan@allspice.io>
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 <i@hiif.ong>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-committed-by: wxiaoguang <wxiaoguang@gmail.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: bytedream <bytedream@protonmail.com>
Co-committed-by: bytedream <bytedream@protonmail.com>
2025-04-13 17:54:09 +00:00
juke
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 <j.kerssemakers@gsi.de>
Reviewed-on: https://gitea.com/gitea/docs/pulls/203
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: juke <juke@noreply.gitea.com>
Co-committed-by: juke <juke@noreply.gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: Kerwin Bryant <kerwin612@qq.com>
Co-committed-by: Kerwin Bryant <kerwin612@qq.com>
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
recoolcz
330f8b808b CAD File Preview - Last Change (markup, spelling, script) (#201)
Fixed all remaining issues (spelling mistakes, markup, etc.)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/201
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: recoolcz <recoolcz@noreply.gitea.com>
Co-committed-by: recoolcz <recoolcz@noreply.gitea.com>
2025-04-08 15:13:15 +00:00
recoolcz
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 <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/200
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: recoolcz <petrvanek31@gmail.com>
Co-committed-by: recoolcz <petrvanek31@gmail.com>
2025-04-08 06:48:11 +00:00
Lunny Xiao
ae186bfdcc Update to 1.23.7 2025-04-07 15:41:45 -07:00
recoolcz
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 <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/199
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: recoolcz <petrvanek31@gmail.com>
Co-committed-by: recoolcz <petrvanek31@gmail.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-committed-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-05 05:08:06 +00:00
Bo-Yi Wu (吳柏毅)
802aeb1e0c docs: update zh-tw (#197)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/197
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/197
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2025-04-05 00:57:20 +00:00
appleboy
dbfa0ba454 docs: add zh-tw folder (#195)
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/195
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-04-01 21:04:28 +00:00
ManInDark
bec3fc4398 SSH multiple IPs (#194)
Added documentation for alternative ssh setup if multiple IPs are available.

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/194
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: ManInDark <ManInDark@noreply.gitea.com>
Co-committed-by: ManInDark <ManInDark@noreply.gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <wxiaoguang@noreply.gitea.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-committed-by: yp05327 <576951401@qq.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: BenoitDuffez <benoitduffez@noreply.gitea.com>
Co-committed-by: BenoitDuffez <benoitduffez@noreply.gitea.com>
2025-03-13 22:00:07 +00:00
wxiaoguang
2b1f9ff532 Add FILE_ICON_THEME (#181)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/181
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-committed-by: wxiaoguang <wxiaoguang@gmail.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-committed-by: wxiaoguang <wxiaoguang@gmail.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
2025-03-07 03:29:13 +00:00
wethinkagile
3f023b3b62 fix/get-tokens-example (#179)
Users reported issues at https://github.com/go-gitea/gitea/issues/28820

Co-authored-by: Stephan Kristyn <account@stevek.pro>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/179
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: wethinkagile <wethinkagile@noreply.gitea.com>
Co-committed-by: wethinkagile <wethinkagile@noreply.gitea.com>
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 <felix.sommer@ludofact.de>
Co-committed-by: Felix Sommer <felix.sommer@ludofact.de>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-committed-by: techknowlogick <techknowlogick@gitea.com>
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 <xiaolunwen@gmail.com>
Co-authored-by: b-nagaj <bryce.nagaj@proton.me>
Co-committed-by: b-nagaj <bryce.nagaj@proton.me>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <techknowlogick@noreply.gitea.com>
Co-authored-by: Brandon Philips <brandon@ifup.org>
Co-committed-by: Brandon Philips <brandon@ifup.org>
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 <kn4ck3r@noreply.gitea.com>
Reviewed-by: Lunny Xiao <lunny@noreply.gitea.com>
Co-authored-by: strathmeyer <strathmeyer@noreply.gitea.com>
Co-committed-by: strathmeyer <strathmeyer@noreply.gitea.com>
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 <99rgosse@noreply.gitea.com>
Co-committed-by: 99rgosse <99rgosse@noreply.gitea.com>
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 <lunny@noreply.gitea.com>
Co-authored-by: woshishabii <woshishabii@noreply.gitea.com>
Co-committed-by: woshishabii <woshishabii@noreply.gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <lunny@noreply.gitea.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-committed-by: yp05327 <576951401@qq.com>
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 <thefox0x7@noreply.gitea.com>
Co-committed-by: TheFox0x7 <thefox0x7@noreply.gitea.com>
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 <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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 <renovate-bot@gitea.com>
Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
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
1200 changed files with 172875 additions and 8303 deletions

View File

@@ -8,10 +8,10 @@ on:
jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
@@ -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:
@@ -37,7 +37,7 @@ jobs:
run: |
make build
- name: aws credential configure
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v5
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}

View File

@@ -7,14 +7,14 @@ jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
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:

View File

@@ -9,15 +9,23 @@ jobs:
update-swagger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- 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.7' '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"

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

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).

View File

@@ -1,5 +1,5 @@
---
date: "2016-12-26T16:00:00+02:00"
date: "2025-10-26T00:00:00+00:00"
slug: "config-cheat-sheet"
sidebar_position: 30
aliases:
@@ -40,7 +40,7 @@ generate Gitea's `app.ini` from environment variables.
## Default Internal Variables (non-`app.ini` configuration)
These values are environment-dependent but form the basis of a lot of values. They will be
reported as part of the default configuration when running `gitea help` or on start-up.
reported as part of the default configuration when running `gitea help` or on start-up.
The order they are emitted there is slightly different but we will list them here in the order they are set-up.
- _`AppPath`_: This is the absolute path of the running gitea binary.
@@ -99,7 +99,7 @@ In addition, there is _`StaticRootPath`_ which can be set as a built-in at build
default is not to present.
:::warning
This maybe harmful to you website if you do not give it a right value.
This maybe harmful to your website if you do not give it a right value.
:::
- `DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH`: **false**: Close an issue if a commit on a non default branch marks it as closed.
@@ -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
@@ -233,6 +234,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: Additional Emojis not defined in the utf8 standard.
By default, we support Gitea (:gitea:), to add more copy them to public/assets/img/emoji/emoji_name.png and
add it to this config.
- `ENABLED_EMOJIS`: **_empty_**: Comma separated list of enabled emojis, for example: "smile, thumbsup, thumbsdown". Leave it empty to enable all emojis.
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
- `ONLY_SHOW_RELEVANT_REPOS`: **false**: Whether to only show relevant repos on the explore page when no keyword is specified and default sorting is used.
@@ -276,17 +278,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 +308,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.
@@ -614,6 +627,7 @@ And the following unique queues:
- `PASSWORD_CHECK_PWN`: **false**: Check [HaveIBeenPwned](https://haveibeenpwned.com/Passwords) to see if a password has been exposed.
- `SUCCESSFUL_TOKENS_CACHE_SIZE`: **20**: Cache successful token hashes. API tokens are stored in the DB as pbkdf2 hashes however, this means that there is a potentially significant hashing load when there are multiple API operations. This cache will store the successfully hashed tokens in a LRU cache as a balance between performance and security.
- `DISABLE_QUERY_AUTH_TOKEN`: **false**: Reject API tokens sent in URL query string (Accept Header-based API tokens only). This setting will default to `true` in Gitea 1.23 and be deprecated in Gitea 1.24.
- `TWO_FACTOR_AUTH`: **_empty_**: set to enforced to enforce two factor authentication. Only available in Gitea 1.24 and later.
## Camo (`camo`)
@@ -670,15 +684,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 +755,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 +829,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 +1006,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 +1017,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 +1065,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 +1258,9 @@ 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)
## Markup External Render (`markup.external-render-name`)
Gitea can support Markup using external tools. The example below will add a markup named `asciidoc`.
@@ -1227,7 +1274,6 @@ IS_INPUT_FILE = false
```
- ENABLED: **false** Enable markup support; set to **true** to enable this renderer.
- NEED\_POSTPROCESS: **true** set to **true** to replace links / sha1 and etc.
- FILE\_EXTENSIONS: **_empty_** List of file extensions that should be rendered by an external
command. Multiple extensions needs a comma as splitter.
- RENDER\_COMMAND: External command to render all matching extensions.
@@ -1236,6 +1282,10 @@ IS_INPUT_FILE = false
- sanitized: Sanitize the content and render it inside current page, default to only allow a few HTML tags and attributes. Customized sanitizer rules can be defined in `[markup.sanitizer.*]`.
- no-sanitizer: Disable the sanitizer and render the content inside current page. It's **insecure** and may lead to XSS attack if the content contains malicious code.
- iframe: Render the content in a separate standalone page and embed it into current page by iframe. The iframe is in sandbox mode with same-origin disabled, and the JS code are safely isolated from parent page.
- RENDER_CONTENT_SANDBOX: **_empty_** The sandbox applied to the iframe and Content-Security-Policy header when RENDER_CONTENT_MODE is `iframe`. It defaults to a safe set of "allow-*" restrictions (space separated). You can also set it by your requirements or use "disabled" to disable the sandbox completely. When set it, make sure there is no security risk:
- PDF-only content: generally safe to use "disabled", and it needs to be "disabled" because PDF only renders with no sandbox.
- HTML content with JS: if the "RENDER_COMMAND" can guarantee there is no XSS, then it is safe, otherwise, you need to fine tune the "allow-*" restrictions.
- NEED_POST_PROCESS: **false** Whether post-process the rendered HTML content, including: resolve relative links and image sources, recognizing issue/commit references, escaping invisible characters, mentioning users, rendering permlink code blocks, replacing emoji shorthands, etc. By default, this is true when RENDER_CONTENT_MODE is `sanitized`, otherwise false.
Two special environment variables are passed to the render command:

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,180 @@ 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:
```
nano $GITEA_CUSTOM/templates/custom/footer.tmpl
```
```html
<script>
function lS(src) {
return new Promise(function (resolve, reject) {
let s = document.createElement("script");
s.src = src;
s.addEventListener("load", () => {
resolve();
function onPageChange() {
// 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}`));
});
document.body.appendChild(s);
});
}
if (link3D) {
const existingScript = document.querySelector('script[src="/assets/o3dv/o3dv.min.js"]');
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();
const initializeViewer = () => {
const fileUrl = link3D.getAttribute('href');
const fileView = document.querySelector('.file-view');
if (!fileView) return;
// Remove only the old viewer container if it exists
const oldView3D = document.getElementById('view-3d');
if (oldView3D) {
oldView3D.remove(); // safely remove old viewer container div
} else {
// No #view-3d, so remove all children inside .file-view
while (fileView.firstChild) {
fileView.removeChild(fileView.firstChild);
}
}
// Create a new container for the viewer
const newView3D = document.createElement('div');
newView3D.id = 'view-3d';
newView3D.style.padding = '0';
newView3D.style.margin = '0';
newView3D.style.flexGrow = '1';
newView3D.style.minHeight = '0';
newView3D.style.width = '100%';
const header = document.querySelector('header');
const headerHeight = header ? header.offsetHeight : 0;
newView3D.style.height = `calc(100vh - ${headerHeight}px)`;
// Append the new container inside fileView
fileView.appendChild(newView3D);
const parentDiv = document.getElementById('view-3d');
if (parentDiv) {
const viewer = new OV.EmbeddedViewer(parentDiv, {
backgroundColor: new OV.RGBAColor(59, 68, 76, 0),
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)
});
viewer.LoadModelFromUrlList([fileUrl]);
}
};
if (typeof OV === 'undefined') {
if (!existingScript) {
const script = document.createElement('script');
script.onload = initializeViewer;
script.src = '/assets/o3dv/o3dv.min.js';
document.head.appendChild(script);
} else {
// Script is loading but OV not yet ready — wait for it
existingScript.addEventListener('load', initializeViewer);
}
} else {
// OV already loaded
initializeViewer();
}
}
};
// Run when the page is fully loaded
document.addEventListener('DOMContentLoaded', onPageChange);
const targetSelector = 'a.ui.mini.basic.button[href*="/raw/"]';
let lastHref = null;
let timeoutId = null;
const checkAndRun = () => {
const rawLink = document.querySelector(targetSelector);
if (!rawLink) return;
const currentHref = rawLink.getAttribute('href');
if (currentHref !== lastHref) {
lastHref = currentHref;
const fileName = currentHref.split('/').pop();
console.log('New Raw file link detected after delay:', fileName);
onPageChange();
}
};
const observer = new MutationObserver(() => {
// Delay execution by 300ms after last mutation
clearTimeout(timeoutId);
timeoutId = setTimeout(checkAndRun, 300);
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
}
</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.16.0 as of now).
Here use e.g. wget to download the file:
```
wget https://github.com/kovacsv/Online3DViewer/releases/download/0.16.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 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.
Sanity check. You should end-up with a folder structure similar to this:
```
$GITEA_CUSTOM/templates
@@ -218,49 +346,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 +473,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:

View File

@@ -10,6 +10,10 @@ aliases:
Gitea has mailer functionality for sending transactional emails (such as registration confirmation). It can be configured to either use Sendmail (or compatible MTAs like Postfix and msmtp) or directly use SMTP server.
:::note
Be sure to set ENABLE_NOTIFY_MAIL=true to allow Gitea to send email notifications. Check the [Config Cheat Sheet](../administration/config-cheat-sheet.md#service-service) for details.
:::
## Using Sendmail
Use `sendmail` command as mailer.
@@ -56,7 +60,7 @@ For the full list of options check the [Config Cheat Sheet](../administration/co
Authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost`. TLS encryption can be through:
:::
- STARTTLS (also known as Opportunistic TLS) via port 587. Initial connection is done over cleartext, but then be upgraded over TLS if the server supports it.
- STARTTLS (also known as Opportunistic TLS) via port 587 with `PROTOCOL=smtp+starttls`. Initial connection is done over cleartext, but then be upgraded over TLS if the server supports it.
- SMTPS connection (SMTP over TLS) via the default port 465. Connection to the server use TLS from the beginning.
- Forced SMTPS connection with `PROTOCOL=smtps`. (These are both known as Implicit TLS.)
This is due to protections imposed by the Go internal libraries against STRIPTLS attacks.

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

View File

@@ -14,6 +14,7 @@ aliases:
2. Make the reverse-proxy pass `https://git.example.com/foo` to `http://gitea:3000/foo`.
3. Make sure the reverse-proxy does not decode the URI. The request `https://git.example.com/a%2Fb` should be passed as `http://gitea:3000/a%2Fb`.
4. Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea to make Gitea see the real URL being visited.
5. Make sure your webserver has a certificate, including all intermediate and RootCA certificates, for `git clone` and `git pull` to work.
### Use a sub-path
@@ -149,6 +150,20 @@ server {
}
```
## Nginx Proxy Manager
If you are using Nginx Proxy Manager to serve your Gitea instance it differs slighly from the raw Nginx.
It is [adding some directives](https://github.com/NginxProxyManager/nginx-proxy-manager/blob/master/docker/rootfs/etc/nginx/conf.d/include/proxy.conf) for a custom location by default, so you have to skip these from the above mentioned Nginx config. Otherwise Nginx will produce `400 bad request` error due to duplicated directives (`proxy_set_header Host $host` is the particularly problematic one).
So while creating the `/` Custom location, just add the following lines to it's configuration:
```nginx
client_max_body_size 512M;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
```
## Apache HTTPD
If you want Apache HTTPD to serve your Gitea instance, you can add the following to your Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):

View File

@@ -6,12 +6,14 @@ aliases:
- /en-us/signing
---
# GPG Commit Signatures
# GPG/SSH Commit Signatures
Gitea will verify GPG commit signatures in the provided tree by
Gitea will verify gpg/ssh commit signatures in the provided tree by
checking if the commits are signed by a key within the Gitea database,
or if the commit matches the default key for Git.
Additionally Gitea will verify commits signed by ssh keys, which public keys are part of [`TRUSTED_SSH_KEYS`](#general-configuration).
Keys are not checked to determine if they have expired or revoked.
Keys are also not checked with keyservers.
@@ -46,6 +48,11 @@ for GPG - in particular it is probably advisable to only install a
signing secret subkey without the master signing and certifying secret
key.
## Installing and generating a SSH key for Gitea
You can run `ssh-keygen -t ed25519 -f gitea-signing-key` to generate the private/public keypair for commit signing without any password. Usually you would store the key next to the gitea configuration, then point `SIGNING_KEY` to the generated public key `/path/to/gitea-signing-key.pub`. Gitea generates all its commits using the server `git` command at present - and therefore the server `ssh-keygen` will be used for
signing (if configured.)
## General Configuration
Gitea's configuration for signing can be found with the
@@ -65,16 +72,41 @@ MERGES = pubkey, twofa, basesigned, commitssigned
...
```
---
For SSH commit signing, you need to specify the `SIGNING_FORMAT` to `ssh` instead of the default `openpgp`. `SIGNING_NAME` and `SIGNING_EMAIL` are required for verifing the signatures.
This looks like this:
```ini
...
[repository.signing]
SIGNING_KEY = /path/to/gitea-signing-key.pub
SIGNING_NAME =
SIGNING_EMAIL =
SIGNING_FORMAT = ssh
INITIAL_COMMIT = always
CRUD_ACTIONS = pubkey, twofa, parentsigned
WIKI = never
MERGES = pubkey, twofa, basesigned, commitssigned
...
```
- `/path/to/gitea-signing-key` is expected to be the private key for `/path/to/gitea-signing-key.pub` [see here how to generate a new ssh keypair](#installing-and-generating-a-ssh-key-for-gitea).
- `TRUSTED_SSH_KEYS = ssh-<algorithm> <key>` or `TRUSTED_SSH_KEYS = ssh-<algorithm> <key1>, ssh-<algorithm> <key2>` can be used for rotating the global ssh signing key to continue verifying commits signed by the previous keys.
### `SIGNING_KEY`
The first option to discuss is the `SIGNING_KEY`. There are three main
options:
- `none` - this prevents Gitea from signing any commits
- `default` - Gitea will default to the key configured within `git config`
- `default` - Gitea will default to the gpg key configured within `git config`
- `KEYID` - Gitea will sign commits with the gpg key with the ID
`KEYID`. In this case you should provide a `SIGNING_NAME` and
`SIGNING_EMAIL` to be displayed for this key.
- `/path/to/gitea-signing-key.pub` - Gitea will sign commits with the ssh key without the `.pub` suffix `/path/to/gitea-signing-key`. In this case you should provide a `SIGNING_NAME` and
`SIGNING_EMAIL` to be displayed for this key and set `SIGNING_FORMAT` to `ssh`.
The `default` option will interrogate `git config` for
`commit.gpgsign` option - if this is set, then it will use the results
@@ -97,6 +129,10 @@ Related home files for git command (like `.gnupg`) should also be put in Gitea's
If you like to keep the `.gnupg` directory outside of `{[git].HOME_PATH}/`, consider setting the `$GNUPGHOME` environment variable to your preferred location, otherwise Gitea will use the gpg keys only under `{[git].HOME_PATH}/.gnupg`.
:::
:::warning
The default option and repository specific signing keys are not supported for ssh keys
:::
### `INITIAL_COMMIT`
This option determines whether Gitea should sign the initial commit
@@ -168,3 +204,9 @@ In cases where there is a repository specific key this can be obtained from:
```sh
/api/v1/repos/:username/:reponame/signing-key.gpg
```
For ssh commit signing the default ssh public key can be obtained via the API at:
```sh
/api/v1/signing-key.pub
```

View File

@@ -35,8 +35,10 @@ 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

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` |

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.

View File

@@ -13,7 +13,7 @@ Gitea was originally forked from [Gogs](https://gogs.io) and almost all the code
:::warning
Gitea does not sent or cherry-picked commits from upstream, so there is no guarantee it will work if you upgrade from Gogs to Gitea. The recommended method is to migrate repositories from Gogs to Gitea.
Gitea does not send commits to upstream or cherry-pick commits from it, so there is no guarantee it will work if you upgrade from Gogs to Gitea. The recommended method is to migrate repositories from Gogs to Gitea.
:::
@@ -31,11 +31,11 @@ You can try it out using [the online demo](https://demo.gitea.com).
- **Code Hosting**
Gitea supports creating and managing repositories, browsing commit history and code files, reviewing and merging code submissions, managing collaborators, handling branches, and more. It also supports many common Git features such as tags, Cherry-pick, hooks, integrated collaboration tools, and more.
Gitea supports creating and managing repositories, browsing commit history and code files, reviewing and merging code submissions, managing collaborators, handling branches, and more. It also supports many common Git features such as tags, cherry-picking, hooks, integrated collaboration tools, and more.
- **Lightweight and Fast**
One of Gitea's design goals is to be lightweight and fast in response. Unlike some large code hosting platforms, it remains lean, performs well in terms of speed, and is suitable for resource-limited server environments. Due to its lightweight design, Gitea has relatively low resource consumption and performs well in resource-constrained environments.
One of Gitea's design goals is to be lightweight and fast in response. Unlike some large code hosting platforms, it remains lean, performs well in terms of speed, and is suitable for resource-limited server environments.
- **Easy Deployment and Maintenance**
@@ -105,6 +105,6 @@ For more detailed information, please refer to: https://docs.gitea.com/installat
- [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
- [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
## Integrated support
## Integrated Support
Please visit [Awesome Gitea](https://gitea.com/gitea/awesome-gitea/) to get more third-party integrated support

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
```

View File

@@ -46,7 +46,7 @@ Gitea signs all binaries with a [GPG key](https://keys.openpgp.org/search?q=teab
To validate the binary, download the signature file which ends in `.asc` for the binary you downloaded and use the GPG command line tool.
```sh
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-@version@-linux-amd64.asc gitea-@version@-linux-amd64
```

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

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)
@@ -384,7 +386,7 @@ In this option, the idea is that the host simply uses the `authorized_keys` that
- Please note depending on the local version of ssh you may want to consider using `-t ecdsa` here.
- `/home/git/.ssh/authorized_keys` on the host now needs to be modified. It needs to act in the same way as `authorized_keys` within the Gitea container. Therefore add the public key of the key you created above ("Gitea Host Key") to `~/git/.ssh/authorized_keys`. As an administrative user on the host run:
- `/home/git/.ssh/authorized_keys` on the host now needs to be modified. It needs to act in the same way as `authorized_keys` within the Gitea container. Therefore add the public key of the key you created above ("Gitea Host Key") to `/home/git/.ssh/authorized_keys`. As an administrative user on the host run:
```bash
sudo -u git cat /home/git/.ssh/id_rsa.pub | sudo -u git tee -a /home/git/.ssh/authorized_keys
@@ -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.

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`.
@@ -128,6 +128,30 @@ If this file is missing or corrupted, you can simply remove it and register agai
If you want to store the registration information in another place, you can specify it in the configuration file,
and don't forget to specify the `--config` option.
#### Ephemeral Runners
Ephemeral runners provide a security hardening mechanism for enabling organization- or instance-wide runners without requiring full user trust. Once a job is assigned within a spot VM or container, the runner's exposed credentials are automatically revoked—blocking it from polling further jobs before any untrusted code runs, while still allowing it to report progress until completion by either Gitea or the runner.
act_runner **0.2.12+** required.
The updated commands for registering the runner as ephemeral are listed below. Refer to the previous section for detailed information on registering the act_runner.
```bash
./act_runner register --ephemeral
```
```bash
./act_runner --config config.yaml register --ephemeral
```
```bash
./act_runner register --no-interactive --ephemeral --instance <instance_url> --token <registration_token> --name <runner_name> --labels <runner_labels>
```
The runner must be registered each time it is intended to receive a job. After completing the single job it is designed to execute, the runner terminates.
To automate the registration and startup of new runners when a job is queued, use the `workflow_job` webhook.
### Start the runner in command line
After you have registered the runner, you can run it by running the following command:
@@ -210,7 +234,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>
@@ -297,6 +321,36 @@ It is because the act runner will run jobs in docker containers, so it needs to
As mentioned, you can remove it if you want to run jobs in the host directly.
To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine.
---
To enable ephemeral runners, set the environment variable `GITEA_RUNNER_EPHEMERAL=1` in the runner image. This setup doesn't use a `/data` volume because the credentials are single-use and not intended to be reused. You can find more details about this mode under [Ephemeral runners](#ephemeral-runners).
```bash
docker run \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_EPHEMERAL=1 \
-e GITEA_RUNNER_NAME=<runner_name> \
--name my_runner \
-d docker.io/gitea/act_runner:nightly
```
```bash
docker run \
-v $PWD/config.yaml:/config.yaml \
-v /var/run/docker.sock:/var/run/docker.sock \
-e CONFIG_FILE=/config.yaml \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_EPHEMERAL=1 \
-e GITEA_RUNNER_NAME=<runner_name> \
-e GITEA_RUNNER_LABELS=<runner_labels> \
--name my_runner \
-d docker.io/gitea/act_runner:nightly
```
Mounting the host's Docker socket using `/var/run/docker.sock:/var/run/docker.sock` introduces a potential security vulnerability. If a job can access this socket, the reusable `GITEA_RUNNER_REGISTRATION_TOKEN` could be exposed through Docker inspect data.
### Start the runner using docker compose
You could also set up the runner using the following `docker-compose.yml`:
@@ -320,7 +374,30 @@ 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
---
To enable ephemeral runners, set the environment variable `GITEA_RUNNER_EPHEMERAL=1` in the runner image. This setup doesn't use a `/data` volume because the credentials are single-use and not intended to be reused. You can find more details about this mode under [Ephemeral runners](#ephemeral-runners).
```yml
version: "3.8"
services:
runner:
image: docker.io/gitea/act_runner:nightly
environment:
CONFIG_FILE: /config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
GITEA_RUNNER_EPHEMERAL: "1"
volumes:
- ./config.yaml:/config.yaml
- /var/run/docker.sock:/var/run/docker.sock
```
Mounting the host's Docker socket using `/var/run/docker.sock:/var/run/docker.sock` introduces a potential security vulnerability. If a job can access this socket, the reusable `GITEA_RUNNER_REGISTRATION_TOKEN` could be exposed through Docker inspect data.
## Advanced Configurations
### Configuring cache when starting a Runner using docker image

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`.

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?
@@ -161,6 +163,8 @@ For events supported only by GitHub, see GitHub's [documentation](https://docs.g
| pull_request_review_comment | `created`, `edited` |
| release | `published`, `edited` |
| registry_package | `published` |
| workflow_dispatch | not applicable |
| workflow_run | `requested`, `completed` |
> For `pull_request` events, in [GitHub Actions](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request), the `ref` is `refs/pull/:prNumber/merge`, which is a reference to the merge commit preview. However, Gitea has no such reference.
> Therefore, the `ref` in Gitea Actions is `refs/pull/:prNumber/head`, which points to the head of pull request rather than the preview of the merge commit.

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.

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).
:::

125
docs/usage/markdown.md Normal file
View File

@@ -0,0 +1,125 @@
---
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
```
````
## Frontmatter
Gitea supports frontmatter and Table of Contents (TOC) rendering. By default, frontmatter rendering is enabled, and TOC rendering is disabled.
### Enabling TOC rendering
To enable TOC rendering for a markdown file, add `include_toc: true` to its frontmatter section.
### Disabling frontmatter
To disable frontmatter rendering for a markdown file, add `gitea: none` to its frontmatter section.
### Example
```yaml
---
include_toc: true
gitea: none
---
```
Then, when you preview this markdown file in Gitea, the frontmatter section will not be rendered, and a Table of Contents will be generated at the top of the content.

View File

@@ -1,7 +1,7 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
import {themes as prismThemes} from 'prism-react-renderer';
import { themes as prismThemes } from "prism-react-renderer";
const lightCodeTheme = prismThemes.github;
const darkCodeTheme = prismThemes.dracula;
@@ -9,188 +9,224 @@ const darkCodeTheme = prismThemes.dracula;
// order usage directory by type first
function sortItemsByCategory(items) {
// type with "category" (directory) first
const sortedItems = items.sort(function(a, b) {
const sortedItems = items.sort(function (a, b) {
return a.type.localeCompare(b.type);
})
});
return sortedItems;
}
const renderApiSSR = process.env.API_SSR !== 'false';
const renderApiSSR = process.env.API_SSR !== "false";
const apiConfig = [
'redocusaurus',
"redocusaurus",
{
// Plugin Options for loading OpenAPI files
specs: renderApiSSR ? [
{
spec: 'static/swagger-latest.json',
route: '/api/next/',
},
{
route: '/api/1.22/',
spec: 'static/swagger-22.json',
},
{
route: '/api/1.21/',
spec: 'static/swagger-21.json',
},
{
route: '/api/1.20/',
spec: 'static/swagger-20.json',
},
{
route: '/api/1.19/',
spec: 'static/swagger-19.json',
},
{
route: '/api/',
spec: 'static/swagger-22.json',
}
]: [],
specs: renderApiSSR
? [
{
route: "/api/next/",
spec: "static/swagger-latest.json",
},
{
route: "/api/",
spec: "static/swagger-24.json",
},
{
route: "/api/1.24/",
spec: "static/swagger-24.json",
},
{
route: "/api/1.23/",
spec: "static/swagger-23.json",
},
{
route: "/api/1.22/",
spec: "static/swagger-22.json",
},
{
route: "/api/1.21/",
spec: "static/swagger-21.json",
},
{
route: "/api/1.20/",
spec: "static/swagger-20.json",
},
{
route: "/api/1.19/",
spec: "static/swagger-19.json",
},
]
: [],
// Theme Options for modifying how redoc renders them
theme: {
// Change with your site colors
primaryColor: '#1890ff',
primaryColor: "#1890ff",
},
},
]
];
const pageConfig = renderApiSSR ? {
exclude: [
'api/**',
],
}: {}
const pageConfig = renderApiSSR
? {
exclude: ["api/**"],
}
: {};
const globalVariables = {
current: {
'goVersion': '1.22',
'minGoVersion': '1.22',
'minNodeVersion': '18',
'version': 'main-nightly',
'sourceVersion': 'main',
'sourceBranch': 'main',
'dockerVersion': 'nightly',
'displayVersion': '1.24-dev'
goVersion: "1.24",
minGoVersion: "1.24",
minNodeVersion: "22",
version: "main-nightly",
sourceVersion: "main",
sourceBranch: "main",
dockerVersion: "nightly",
displayVersion: "1.25-dev",
},
'1.23': {
'goVersion': '1.23',
'minGoVersion': '1.22',
'minNodeVersion': '18',
'version': '1.23.0-rc0',
'sourceVersion': 'v1.23.0-rc0',
'sourceBranch': 'release/v1.23',
'dockerVersion': '1.23.0-rc0',
'displayVersion': '1.23.0-rc0'
1.24: {
goVersion: "1.24",
minGoVersion: "1.24",
minNodeVersion: "22",
version: "1.24.7",
sourceVersion: "v1.24.0",
sourceBranch: "release/v1.24",
dockerVersion: "1.24.7",
displayVersion: "1.24.7",
},
'1.22': {
'goVersion': '1.22',
'minGoVersion': '1.22',
'minNodeVersion': '18',
'version': '1.22.6',
'sourceVersion': 'v1.22.6',
'sourceBranch': 'release/v1.22',
'dockerVersion': '1.22.6',
'displayVersion': '1.22.6'
1.23: {
goVersion: "1.23",
minGoVersion: "1.22",
minNodeVersion: "18",
version: "1.23.8",
sourceVersion: "v1.23.8",
sourceBranch: "release/v1.23",
dockerVersion: "1.23.8",
displayVersion: "1.23.8",
},
'1.21': {
'goVersion': '1.21',
'minGoVersion': '1.21',
'minNodeVersion': '18',
'version': '1.21.11',
'sourceVersion': 'v1.21.11',
'sourceBranch': 'release/v1.21',
'dockerVersion': '1.21.11',
'displayVersion': '1.21.11'
1.22: {
goVersion: "1.22",
minGoVersion: "1.22",
minNodeVersion: "18",
version: "1.22.6",
sourceVersion: "v1.22.6",
sourceBranch: "release/v1.22",
dockerVersion: "1.22.6",
displayVersion: "1.22.6",
},
'1.20': {
'goVersion': '1.20',
'minGoVersion': '1.20',
'minNodeVersion': '16',
'version': '1.20.6',
'sourceVersion': 'v1.20.6',
'sourceBranch': 'release/v1.20',
'dockerVersion': '1.20.6',
'displayVersion': '1.20.6'
1.21: {
goVersion: "1.21",
minGoVersion: "1.21",
minNodeVersion: "18",
version: "1.21.11",
sourceVersion: "v1.21.11",
sourceBranch: "release/v1.21",
dockerVersion: "1.21.11",
displayVersion: "1.21.11",
},
'1.19': {
'goVersion': '1.20',
'minGoVersion': '1.19',
'minNodeVersion': '14',
'version': '1.19.4',
'sourceVersion': 'v1.19.4',
'sourceBranch': 'release/v1.19',
'dockerVersion': '1.19.4',
'displayVersion': '1.19.4'
}
}
"1.20": {
goVersion: "1.20",
minGoVersion: "1.20",
minNodeVersion: "16",
version: "1.20.6",
sourceVersion: "v1.20.6",
sourceBranch: "release/v1.20",
dockerVersion: "1.20.6",
displayVersion: "1.20.6",
},
1.19: {
goVersion: "1.20",
minGoVersion: "1.19",
minNodeVersion: "14",
version: "1.19.4",
sourceVersion: "v1.19.4",
sourceBranch: "release/v1.19",
dockerVersion: "1.19.4",
displayVersion: "1.19.4",
},
};
const versions = {
current: {
label: globalVariables['current'].displayVersion, // path is kept as next for dev (so users can always find "nightly" docs)
banner: 'unreleased',
label: globalVariables["current"].displayVersion, // path is kept as next for dev (so users can always find "nightly" docs)
banner: "unreleased",
},
'1.23': {
label: globalVariables['1.23'].displayVersion,
1.24: {
label: globalVariables["1.24"].displayVersion,
},
'1.22': {
label: globalVariables['1.22'].displayVersion,
1.23: {
label: globalVariables["1.23"].displayVersion,
},
'1.21': {
label: globalVariables['1.21'].displayVersion,
1.22: {
label: globalVariables["1.22"].displayVersion,
},
'1.20': {
label: globalVariables['1.20'].displayVersion,
1.21: {
label: globalVariables["1.21"].displayVersion,
},
'1.19': {
label: globalVariables['1.19'].displayVersion,
}
}
"1.20": {
label: globalVariables["1.20"].displayVersion,
},
1.19: {
label: globalVariables["1.19"].displayVersion,
},
};
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Gitea Documentation',
tagline: 'Git with a cup of tea',
url: 'https://docs.gitea.com',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.png',
title: "Gitea Documentation",
tagline: "Git with a cup of tea",
url: "https://docs.gitea.com",
baseUrl: "/",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.png",
future: {
experimental_faster: true,
v4: true
},
plugins: [
[
'docusaurus-plugin-plausible',
"docusaurus-plugin-plausible",
{
domain: 'docs.gitea.com',
domain: "docs.gitea.com",
},
],
// for runner documentations
[
'@docusaurus/plugin-content-docs',
"@docusaurus/plugin-content-docs",
{
id: 'runner',
path: 'runner',
routeBasePath: 'runner',
id: "runner",
path: "runner",
routeBasePath: "runner",
//sidebarPath: './runner/sidebars.js',
versions: {
current: {
label: 'main',
banner: 'unreleased',
label: "main",
banner: "unreleased",
},
"0.2.11": {
path: '0.2.11',
label: '0.2.11',
}
path: "0.2.11",
label: "0.2.11",
},
},
lastVersion: '0.2.11',
editUrl: ({versionDocsDirPath, docPath, locale, version, permalink}) => {
return `https://gitea.com/gitea/docs/src/branch/main/${version === 'current' ? 'runner': `runner_versioned_docs/version-${version}`}/${docPath}`;
lastVersion: "0.2.11",
editUrl: ({
versionDocsDirPath,
docPath,
locale,
version,
permalink,
}) => {
return `https://gitea.com/gitea/docs/src/branch/main/${
version === "current"
? "runner"
: `runner_versioned_docs/version-${version}`
}/${docPath}`;
},
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
const {item} = args;
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const { item } = args;
// Use the provided data to generate a custom sidebar slice
const sidebarItems = await defaultSidebarItemsGenerator(args);
if (item.dirName !== 'usage') {
if (item.dirName !== "usage") {
return sidebarItems;
} else {
return sortItemsByCategory(sidebarItems);
@@ -201,44 +237,62 @@ const config = {
],
i18n: {
defaultLocale: 'en-us',
locales: ['en-us', 'zh-cn'/*,'fr-fr', 'zh-tw'*/], // temporarily disable other locales
defaultLocale: "en-us",
locales: ["en-us", "zh-cn", "zh-tw"],
localeConfigs: {
'en-us': {
label: 'English',
"en-us": {
label: "English",
},
'zh-cn': {
label: '中文',
"zh-cn": {
label: "简体中文",
},
"zh-tw": {
label: "繁體中文",
},
},
},
presets: [
[
'@docusaurus/preset-classic',
"@docusaurus/preset-classic",
//'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
routeBasePath: '/', // Serve the docs at the site's root
editUrl: ({versionDocsDirPath, docPath, locale, version, permalink}) => {
sidebarPath: require.resolve("./sidebars.js"),
routeBasePath: "/", // Serve the docs at the site's root
editUrl: ({
versionDocsDirPath,
docPath,
locale,
version,
permalink,
}) => {
// Special case for awesome page
if (docPath.includes('awesome.md')) {
return `https://gitea.com/gitea/awesome-gitea/src/branch/main/README.md`
if (docPath.includes("awesome.md")) {
return `https://gitea.com/gitea/awesome-gitea/src/branch/main/README.md`;
}
if (locale === 'en-us') {
return `https://gitea.com/gitea/docs/src/branch/main/${version === 'current' ? 'docs': `versioned_docs/version-${version}`}/${docPath}`;
if (locale === "en-us") {
return `https://gitea.com/gitea/docs/src/branch/main/${
version === "current"
? "docs"
: `versioned_docs/version-${version}`
}/${docPath}`;
}
return `https://gitea.com/gitea/docs/src/branch/main/i18n/${locale}/docusaurus-plugin-content-docs/${version === 'current' ? 'current': `version-${version}`}/${docPath}`;
return `https://gitea.com/gitea/docs/src/branch/main/i18n/${locale}/docusaurus-plugin-content-docs/${
version === "current" ? "current" : `version-${version}`
}/${docPath}`;
},
versions: versions,
lastVersion: '1.22',
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
const {item} = args;
lastVersion: "1.24",
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const { item } = args;
// Use the provided data to generate a custom sidebar slice
const sidebarItems = await defaultSidebarItemsGenerator(args);
if (item.dirName !== 'usage') {
if (item.dirName !== "usage") {
return sidebarItems;
} else {
return sortItemsByCategory(sidebarItems);
@@ -247,37 +301,40 @@ const config = {
},
blog: false,
theme: {
customCss: require.resolve('./src/css/custom.css'),
customCss: require.resolve("./src/css/custom.css"),
},
pages: pageConfig,
gtag: {
trackingID: 'G-KHM0KYT506'
trackingID: "G-KHM0KYT506",
},
}),
],
apiConfig,
],
markdown: {
preprocessor: ({filePath, fileContent}) => {
var key = '';
preprocessor: ({ filePath, fileContent }) => {
var key = "";
var found = false;
for (key in globalVariables) {
let folderName = (key == 'current' ? 'current' : `version-${key}`);
let folderName = key == "current" ? "current" : `version-${key}`;
if (filePath.includes(`/${folderName}/`)) {
found = true;
break;
}
}
if (key == '' || !found) {
key = 'current';
if (key == "" || !found) {
key = "current";
}
let content = fileContent;
for (const variable in globalVariables[key]) {
content = content.replaceAll('@'+variable+'@', globalVariables[key][variable]);
content = content.replaceAll(
"@" + variable + "@",
globalVariables[key][variable]
);
}
return content
return content;
},
},
themes: [
@@ -289,164 +346,174 @@ const config = {
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
indexBlog: false,
docsRouteBasePath: "/"
}
]
docsRouteBasePath: "/",
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: '/img/gitea.svg',
metadata: [
{name: 'keywords', content: 'gitea, git, devops, actions, packages, documentation, self-hosted, open-source, version control, gitlab, github'}
{
name: 'og:logo',
content: '/img/gitea.svg'
},
{
name: "keywords",
content:
"gitea, git, devops, actions, packages, documentation, self-hosted, open-source, version control, gitlab, github",
},
],
colorMode: {
defaultMode: 'light',
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: true,
},
announcementBar: {
id: 'announcementBar-4', // Increment on change
id: "announcementBar-4", // Increment on change
content: `<a href="https://about.gitea.com/products/cloud">Try &nbsp; Gitea Cloud &nbsp; ☁️ &nbsp; for 30 days <span aria-hidden="true">&rarr;</span> Accelerate your Development & Deploys!</a>`,
},
navbar: {
title: 'Gitea',
title: "Gitea",
logo: {
alt: 'Gitea Logo',
src: 'img/gitea.svg',
href: 'https://about.gitea.com/',
target: '_self',
alt: "Gitea Logo",
src: "img/gitea.svg",
href: "https://about.gitea.com/",
target: "_self",
},
items: [
{
type: 'doc',
docId: 'index',
position: 'left',
label: 'Docs',
type: "doc",
docId: "index",
position: "left",
label: "Docs",
},
{
to: '/api/1.22/',
label: 'API',
position: 'left',
activeBaseRegex: 'api/(1.19|1.20|1.21|1.22|1.23|next)/',
to: "/api/1.24/",
label: "API",
position: "left",
activeBaseRegex: "api/(1.19|1.20|1.21|1.22|1.23|1.24|next)/",
},
{
to: '/runner/0.2.11/',
label: 'Runner',
position: 'left',
activeBaseRegex: 'runner/(0.2.11|next)/',
to: "/runner/0.2.11/",
label: "Runner",
position: "left",
activeBaseRegex: "runner/(0.2.11|next)/",
},
{
position: 'left',
label: 'Enterprise',
href: 'https://docs.gitea.com/enterprise',
className: 'internal-href',
target: '_self',
position: "left",
label: "Enterprise",
href: "https://docs.gitea.com/enterprise",
className: "internal-href",
target: "_self",
},
{
type: 'search',
position: 'right',
type: "search",
position: "right",
},
{
type: 'localeDropdown',
position: 'right',
type: "localeDropdown",
position: "right",
},
{
type: 'docsVersionDropdown',
position: 'right',
type: "docsVersionDropdown",
position: "right",
dropdownActiveClassDisabled: true,
},
{
type: 'custom-Dropdown',
label: 'API Version',
position: 'right',
type: "custom-Dropdown",
label: "API Version",
position: "right",
items: [
{to: '/api/next/', label: '1.24-dev' },
{to: '/api/1.23/', label: '1.23.0-rc0' },
{to: '/api/1.22/', label: '1.22.6' },
{to: '/api/1.21/', label: '1.21.11' },
{to: '/api/1.20/', label: '1.20.6' },
{to: '/api/1.19/', label: '1.19.4' },
{ to: "/api/next/", label: "1.25-dev" },
{ to: "/api/1.24/", label: "1.24.7" },
{ to: "/api/1.23/", label: "1.23.8" },
{ to: "/api/1.22/", label: "1.22.6" },
{ to: "/api/1.21/", label: "1.21.11" },
{ to: "/api/1.20/", label: "1.20.6" },
{ to: "/api/1.19/", label: "1.19.4" },
],
routerRgx: '\/api\/',
classNames: 'api-dropdown',
routerRgx: "/api/",
classNames: "api-dropdown",
},
{
type: 'custom-Dropdown',
label: 'Runner Version',
position: 'right',
type: "custom-Dropdown",
label: "Runner Version",
position: "right",
items: [
{to: '/runner/next/', label: 'development' },
{to: '/runner/0.2.11/', label: '0.2.11' },
{ to: "/runner/next/", label: "development" },
{ to: "/runner/0.2.11/", label: "0.2.11" },
],
routerRgx: '\/runner\/',
classNames: 'runner-dropdown',
routerRgx: "/runner/",
classNames: "runner-dropdown",
},
{
to: 'help/support',
position: 'right',
label: 'Support',
activeBaseRegex: 'help/support',
to: "help/support",
position: "right",
label: "Support",
activeBaseRegex: "help/support",
},
{
href: 'https://gitea.com/user/login',
label: 'Sign In',
position: 'right',
className: 'internal-href signin-button',
target: '_self',
href: "https://gitea.com/user/login",
label: "Sign In",
position: "right",
className: "internal-href signin-button",
target: "_self",
},
],
},
footer: {
style: 'dark',
style: "dark",
links: [
{
title: 'Community',
title: "Community",
items: [
{
label: 'Awesome Gitea',
href: 'https://gitea.com/gitea/awesome-gitea',
label: "Awesome Gitea",
href: "https://gitea.com/gitea/awesome-gitea",
},
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/gitea',
label: "Stack Overflow",
href: "https://stackoverflow.com/questions/tagged/gitea",
},
{
label: 'Discord',
href: 'https://discord.gg/gitea',
label: "Discord",
href: "https://discord.gg/gitea",
},
{
label: 'Matrix',
href: 'https://matrix.to/#/#gitea-space:matrix.org',
label: "Forum",
href: "https://forum.gitea.com/",
},
{
label: 'Forum',
href: 'https://forum.gitea.com/',
label: "Twitter",
href: "https://twitter.com/giteaio",
},
{
label: 'Twitter',
href: 'https://twitter.com/giteaio',
label: "Mastodon",
href: "https://social.gitea.io/@gitea",
},
{
label: 'Mastodon',
href: 'https://social.gitea.io/@gitea',
label: "Bluesky",
href: "https://bsky.app/profile/gitea.com",
},
],
},
{
title: 'Code',
title: "Code",
items: [
{
label: 'GitHub',
href: 'https://github.com/go-gitea/gitea',
label: "GitHub",
href: "https://github.com/go-gitea/gitea",
},
{
label: 'Gitea',
href: 'https://gitea.com/gitea',
label: "Gitea",
href: "https://gitea.com/gitea",
},
{
label: 'Tea CLI',
href: 'https://gitea.com/gitea/tea',
label: "Tea CLI",
href: "https://gitea.com/gitea/tea",
},
],
},
@@ -455,7 +522,7 @@ const config = {
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['ini','diff','json','http','docker','php'],
additionalLanguages: ["ini", "diff", "json", "http", "docker", "php"],
},
}),
};

View File

@@ -5,7 +5,6 @@ sidebar_position: 110
aliases:
- /zh-cn/adding-legal-pages
---
# 添加法律页面

View File

@@ -10,7 +10,7 @@ aliases:
## 轻量级目录访问协议Lightweight Directory Access ProtocolLDAP
通过BindDNLDAP和简单认证方式LDAP共享以下字段:
通过 BindDNLDAP 和简单认证方式 LDAP 共享以下字段:
- 认证名称 **(必选)**
@@ -27,48 +27,52 @@ aliases:
- 例如: LDAP `389`/ LDAPs `636`
- 安全协议 (可选)
- 连接LDAP服务器时是否使用TLS协议。
- 连接 LDAP 服务器时是否使用 TLS 协议。
- 管理员过滤规则 (可选)
- 一个LDAP过滤器用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件则该用户将被授予管理员权限。
- 一个 LDAP 过滤器,用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件,则该用户将被授予管理员权限。
- 示例:`(objectClass=adminAccount)`
- 适用于Microsoft Active DirectoryAD的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
- 适用于 Microsoft Active DirectoryAD的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
- 用户名属性(可选)
- 用户LDAP记录中包含用户名称的属性。在第一次成功登录后将使用指定的属性值作为新的Gitea账户用户名。若留空则使用登录表单上提供的用户名。
- 当提供的登录名与多个属性匹配时这一选项非常有用但是只有一个特定属性应该用于Gitea账户名称请参阅"用户过滤器"。
- 用户 LDAP 记录中包含用户名称的属性。在第一次成功登录后,将使用指定的属性值作为新的 Gitea 账户用户名。若留空,则使用登录表单上提供的用户名。
- 当提供的登录名与多个属性匹配时,这一选项非常有用,但是只有一个特定属性应该用于 Gitea 账户名称,请参阅"用户过滤器"。
- 示例:uid
- 适用于Microsoft Active DirectoryAD的示例:`sAMAccountName`
- 适用于 Microsoft Active DirectoryAD的示例:`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)
这个过程启用了PAMPluggable Authentication Modules认证。用户仍然可以通过用户管理手动添加到系统中。
PAM提供了一种机制通过对用户进行PAM认证来自动将其添加到当前数据库中。为了与普通的Linux密码一起使用
运行Gitea的用户还必须具有对`/etc/shadow`的读取权限,以便在使用公钥登录时检查账户的有效性。
这个过程启用了 PAMPluggable 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`
- 名称:任何有效的值都可以,如果您愿意,可以使用"System Authentication"。
- 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`而不是`gituser@mail.com`登录到GiteaWeb界面。
[^2]: **PAM 的必选项** 请注意:在上面的示例中,用户将作为`gituser`而不是`gituser@mail.com`登录到 GiteaWeb 界面。
## 简单邮件传输协议(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 InterfaceSSPI实现SPNEGO单点登录认证由RFC4559定义的方案用于服务器的Web部分。SSPI仅在Windows环境中工作即当服务器和客户端都在Windows操作系统上运行时。
Gitea 支持通过 Windows 内置的安全支持提供程序接口Security Support Provider InterfaceSSPI实现 SPNEGO 单点登录认证(由 RFC4559 定义的方案),用于服务器的 Web 部分。SSPI 仅在 Windows 环境中工作,即当服务器和客户端都在 Windows 操作系统上运行时。
在激活SSPI单点登录认证SSO之前您需要准备您的环境:
在激活 SSPI 单点登录认证SSO之前您需要准备您的环境:
- 在Active Directory中创建一个单独的用户账户gitea.exe 进程将在该账户下运行例如在domain.local域下创建一个名为user的账户:
- 为运行gitea.exe的主机创建一个服务主体名称Service Principal NameSPN其类别为HTTP:
- 在 Active Directory 中创建一个单独的用户账户gitea.exe 进程将在该账户下运行(例如,在 domain.local 域下创建一个名为 user 的账户:
- 为运行 gitea.exe 的主机创建一个服务主体名称Service Principal NameSPN其类别为 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. 如果您使用ChromeEdge浏览器请将Web应用程序的URL添加到“本地站点”`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
7. 启动ChromeEdge浏览器导航到GiteaFQDN URL例如`http://host.domain.local:3000`)。
8. 在控制面板中点击“Sign In”按钮然后选择SSPI将会自动使用当前登录到计算机的用户进行登录。
6. 如果您使用 ChromeEdge 浏览器,请将 Web 应用程序的 URL 添加到“本地站点”(`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
7. 启动 ChromeEdge 浏览器,导航到 GiteaFQDN 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 启用此认证方法:

View File

@@ -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` 环境变量。
@@ -48,12 +47,12 @@ Gitea 包括数据库、文件和 Git 仓库,当它被使用时所有这些都
```sh
# mysql
mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
mysqldump -u$USER -p$PASS --databases $DATABASE > gitea-db.sql
# postgres
pg_dump -U $USER $DATABASE > gitea-db.sql
```
### 使用Docker `dump`
### 使用 Docker `dump`
在使用 Docker 时,使用 `dump` 命令有一些注意事项。

View File

@@ -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/**`
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。

View File

@@ -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`
@@ -170,11 +169,11 @@ aliases:
- `--allowed-domains`:留空以允许所有域。使用逗号(',')分隔多个域。
- `--skip-local-2fa`:跳过 2FA 登录。
- `--active`:启用此认证源。
备注:
`--force-smtps``--skip-verify``--disable-helo``--skip-local-2fs``--active` 选项可以采用以下形式使用:
备注:
`--force-smtps``--skip-verify``--disable-helo``--skip-local-2fs``--active` 选项可以采用以下形式使用:
- `--option``--option=true` 以启用选项
- `--option=false` 以禁用选项
如果未指定这些选项,则在 `update-smtp` 中不会更改值,或者在 `add-smtp` 中将使用默认的 `false` 值。
如果未指定这些选项,则在 `update-smtp` 中不会更改值,或者在 `add-smtp` 中将使用默认的 `false` 值。
- 示例:
- `gitea admin auth add-smtp --name ldap --host smtp.mydomain.org --port 587 --skip-verify --active`
- `update-smtp`
@@ -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、unixudp默认为tcp
- `--protocol value`, `-P value`: 设置要使用的协议tcp、unixudp默认为 tcp
- `--address value`, `-a value`: 要连接到的主机地址和端口(默认为:7020
- `smtp`: 添加SMTP日志记录器
- `smtp`: 添加 SMTP 日志记录器
- 选项:
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式

View File

@@ -5,13 +5,12 @@ sidebar_position: 30
aliases:
- /zh-cn/config-cheat-sheet
---
# 配置说明
这是针对Gitea配置文件的说明
你可以了解Gitea的强大配置。
这是针对 Gitea 配置文件的说明,
你可以了解 Gitea 的强大配置。
需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。
如果是从发行版本完成的安装,
@@ -22,14 +21,12 @@ aliases:
包含`#`或者`;`的变量必须使用引号( `` ` `` 或者 `"` )包裹,否则会被解析为注释。
本文档使用以下约定:
* `[section].FOO_BAR` 或 `[section]FOO_BAR`: 一个位于 INI 文件 `[section]` 段中的配置项。
* `FooBar`: 这是一个 Gitea 内部变量,不是一个配置项,仅用于描述相关逻辑。
* `$FOO_BAR`: 这是一个环境变量Gitea 可能会使用它的值,但是它不能直接用于配置文件中。
* `{FOO_BAR}/something` 或 `{FooBar}/something`: 这个值会默认使用配置项 `FOO_BAR` 或者内部变量 `FooBar`。
- `[section].FOO_BAR` 或 `[section]FOO_BAR`: 一个位于 INI 文件 `[section]` 段中的配置项。
- `FooBar`: 这是一个 Gitea 内部变量,不是一个配置项,仅用于描述相关逻辑。
- `$FOO_BAR`: 这是一个环境变量Gitea 可能会使用它的值,但是它不能直接用于配置文件中。
- `{FOO_BAR}/something` 或 `{FooBar}/something`: 这个值会默认使用配置项 `FOO_BAR` 或者内部变量 `FooBar`。
**注意:** 修改完配置文件后,需要重启 Gitea 服务才能生效。
@@ -43,68 +40,68 @@ aliases:
这些值取决于环境,但构成了许多值的基础。当运行 `gitea help`或启动时,它们将
作为默认配置的一部分进行报告。它们在那里发出的顺序略有不同,但我们将按照设置的顺序在这里列出。
- _`AppPath`_: Gitea二进制可执行文件的绝对路径
- _`AppWorkPath`_: Gitea可执行文件的工作目录。 该配置可以通过以下几种方式设置,优先级依次递减:
- _`AppPath`_: Gitea 二进制可执行文件的绝对路径
- _`AppWorkPath`_: Gitea 可执行文件的工作目录。 该配置可以通过以下几种方式设置,优先级依次递减:
- `app.ini`中的`WORK_PATH`配置项
- 启动Gitea时的`--work-path`命令行参数
- 启动 Gitea 时的`--work-path`命令行参数
- `$GITEA_WORK_DIR`环境变量
- 在编译时设置的内置值(参见从源代码编译)
- 默认为 _`AppPath`_ 的目录
- 如果上述任何路径为相对路径,将自动解析为相对于 _`AppPath`_ 目录的绝对路径
- _`CustomPath`_: 这是用于自定义模板和其他选项的基础目录。
它是通过使用以下层次结构中的第一个设置的内容来确定的:
它是通过使用以下层次结构中的第一个设置的内容来确定的:
- 通过传递给二进制文件的`--custom-path`标志
- 环境变量 `$GITEA_CUSTOM`
- 在构建时设置的内置值(参见从源代码构建)
- 否则,默认为 _`AppWorkPath`_`/custom`
- 如果上述任何路径是相对路径,则会相对于 _`AppWorkPath`_ 目录进行处理,
使其变为绝对路径。
使其变为绝对路径。
- _`CustomConf`_: 这是指向`app.ini`文件的路径。
- 这是指向`app.ini`文件的路径。
- 在构建时设置的内置值(参见从源代码构建)
- 否则,默认为 _`CustomPath`_`/conf/app.ini`
- 如果上述任何路径是相对路径,则会相对于_`CustomPath`_目录进行处理。
- 如果上述任何路径是相对路径,则会相对于*`CustomPath`*目录进行处理。
此外,还有_`StaticRootPath`_,可以在构建时设置为内置值,否则将默认为 _`AppWorkPath`_。
此外,还有*`StaticRootPath`*,可以在构建时设置为内置值,否则将默认为 _`AppWorkPath`_。
## Overall (`DEFAULT`)
- `APP_NAME`: **Gitea: Git with a cup of tea** 应用名称,在网页的标题中显示。
- `RUN_USER`: **_current OS username_/`$USER`/`$USERNAME` e.g. git**: 运行Gitea的用户
- `RUN_USER`: **_current OS username_/`$USER`/`$USERNAME` e.g. git**: 运行 Gitea 的用户,
应当是一个专用的系统账户(非用户使用,推荐创建一个专用的`git`用户). 如果在你自己的个人电脑使用改成你自己的用户名。
该配置如果设置不正确Gitea可能崩溃。
该配置如果设置不正确Gitea 可能崩溃。
- `RUN_MODE`: **prod**: 应用的运行模式,对运行性能和问题排除有影响: `dev` 或者 `prod`,默认为 `prod`。 `dev`模式有助于开发和问题排查, 除设置为`dev` 外,均被视为 `prod`.
- `WORK_PATH`: **_the-work-path_**: 工作目录, 前文有提及.
## 仓库 (`repository`)
- `ROOT`: **`{APP_DATA_PATH}/gitea-repositories`**: 存放git工程的根目录建议填绝对路径。
- `ROOT`: **`{APP_DATA_PATH}/gitea-repositories`**: 存放 git 工程的根目录,建议填绝对路径。
相对路径将被解析为**`{AppWorkPath}/{ROOT}`**.
- `SCRIPT_TYPE`: **bash**: 服务器支持的Shell类型通常是`bash`
- `SCRIPT_TYPE`: **bash**: 服务器支持的 Shell 类型,通常是`bash`
但有些服务器也有可能是`sh`。
- `DETECTED_CHARSETS_ORDER`: **UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr**: 检测到的字符集的决定性顺序 - 如果检测到的字符集具有相等的置信度则优先选择列表中较早出现的字符集而不是较晚出现的字符集。添加“defaults”将会将未命名的字符集放置在该点。
- `ANSI_CHARSET`: **_empty_**: 默认的ANSI字符集用于覆盖非UTF-8字符集。
- `ANSI_CHARSET`: **_empty_**: 默认的 ANSI 字符集,用于覆盖非 UTF-8 字符集。
- `FORCE_PRIVATE`: **false**: 强制使每个新仓库变为私有。
- `DEFAULT_PRIVATE`: **last**: 创建新仓库时默认为私有:`last`, `private`, `public`。
- `DEFAULT_PUSH_CREATE_PRIVATE`: **true**: 使用推送创建新仓库时默认为私有。
- `MAX_CREATION_LIMIT`: **-1**: 每个用户的全局仓库创建上限,
`-1` 代表无限制.
`-1` 代表无限制.
- `PREFERRED_LICENSES`: **Apache License 2.0,MIT License**: 要放置在列表顶部的指定许可证。
名称必须与 options/license 或 custom/options/license 中的文件名匹配。
- `DISABLE_HTTP_GIT`: **false**: 禁用HTTP协议与仓库进行
交互的能力。
- `USE_COMPAT_SSH_URI`: **false**: 当使用默认的SSH端口时强制使用ssh://克隆URL
而不是scp-style uri。
- `GO_GET_CLONE_URL_PROTOCOL`: **https**: 用于 "go get" 请求的值返回仓库的URL作为httpsssh
默认为https。
名称必须与 options/license 或 custom/options/license 中的文件名匹配。
- `DISABLE_HTTP_GIT`: **false**: 禁用 HTTP 协议与仓库进行
交互的能力。
- `USE_COMPAT_SSH_URI`: **false**: 当使用默认的 SSH 端口时,强制使用 ssh://克隆 URL
而不是 scp-style uri。
- `GO_GET_CLONE_URL_PROTOCOL`: **https**: 用于 "go get" 请求的值,返回仓库的 URL 作为 httpsssh
默认为 https。
- `ACCESS_CONTROL_ALLOW_ORIGIN`: **_empty_**:用于 Access-Control-Allow-Origin 标头的值,
默认不提供。
警告:如果您不提供正确的值,这可能对您的网站造成危害。
- `DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH`: **false**: 如果非默认分支上的提交将问题标记为已关闭,则关闭该问题。
- `ENABLE_PUSH_CREATE_USER`: **false**: 允许用户将本地存储库推送到Gitea并为用户自动创建它们。
- `ENABLE_PUSH_CREATE_ORG`: **false**: 允许用户将本地存储库推送到Gitea并为组织自动创建它们。
默认不提供。
警告:如果您不提供正确的值,这可能对您的网站造成危害。
- `DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH`: **false**: 如果非默认分支上的提交将问题标记为已关闭,则关闭该问题。
- `ENABLE_PUSH_CREATE_USER`: **false**: 允许用户将本地存储库推送到 Gitea并为用户自动创建它们。
- `ENABLE_PUSH_CREATE_ORG`: **false**: 允许用户将本地存储库推送到 Gitea并为组织自动创建它们。
- `DISABLED_REPO_UNITS`: **_empty_**: 逗号分隔的全局禁用的仓库单元列表。允许的值是:: \[repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects, repo.packages, repo.actions\]
- `DEFAULT_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions**: 逗号分隔的默认新仓库单元列表。允许的值是:: \[repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects, repo.packages, repo.actions\]. 注意目前无法停用代码和发布。如果您指定了默认的仓库单元您仍应将它们列出以保持未来的兼容性。外部wiki和问题跟踪器不能默认启用因为它需要额外的设置。禁用的仓库单元将不会添加到新的仓库中无论它是否在默认列表中。
- `DEFAULT_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions**: 逗号分隔的默认新仓库单元列表。允许的值是:: \[repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects, repo.packages, repo.actions\]. 注意:目前无法停用代码和发布。如果您指定了默认的仓库单元,您仍应将它们列出以保持未来的兼容性。外部 wiki 和问题跟踪器不能默认启用,因为它需要额外的设置。禁用的仓库单元将不会添加到新的仓库中,无论它是否在默认列表中。
- `DEFAULT_FORK_REPO_UNITS`: **repo.code,repo.pulls**: 逗号分隔的默认分叉仓库单元列表。允许的值和规则与`DEFAULT_REPO_UNITS`相同。
- `DEFAULT_MIRROR_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.wiki,repo.projects,repo.packages**: 逗号分隔的默认镜像仓库单元列表。允许的值和规则与`DEFAULT_REPO_UNITS`相同。
- `DEFAULT_TEMPLATE_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages**: 逗号分隔的默认模板仓库单元列表。允许的值和规则与`DEFAULT_REPO_UNITS`相同。
@@ -120,15 +117,15 @@ aliases:
### 仓库 - 编辑器 (`repository.editor`)
- `LINE_WRAP_EXTENSIONS`: **.txt,.md,.markdown,.mdown,.mkd,.livemd,**: 在 Monaco 编辑器中应该换行的文件扩展名列表。用逗号分隔扩展名。要对没有扩展名的文件进行换行,只需放置一个逗号。
- `PREVIEWABLE_FILE_MODES`: **markdown**: 具有预览API的有效文件模式例如 `api/v1/markdown`。用逗号分隔各个值。如果文件扩展名不匹配,编辑模式下的预览选项卡将不会显示。
- `PREVIEWABLE_FILE_MODES`: **markdown**: 具有预览 API 的有效文件模式,例如 `api/v1/markdown`。用逗号分隔各个值。如果文件扩展名不匹配,编辑模式下的预览选项卡将不会显示。
### 仓库 - 合并请求 (`repository.pull-request`)
- `WORK_IN_PROGRESS_PREFIXES`: **WIP:,\[WIP\]**: 在拉取请求标题中用于标记工作正在进行中的前缀列表。
这些前缀在不区分大小写的情况下进行匹配。
这些前缀在不区分大小写的情况下进行匹配。
- `CLOSE_KEYWORDS`: **close**, **closes**, **closed**, **fix**, **fixes**, **fixed**, **resolve**, **resolves**, **resolved**: 在拉取请求评论中用于自动关闭相关问题的关键词列表。
- `REOPEN_KEYWORDS`: **reopen**, **reopens**, **reopened**: 在拉取请求评论中用于自动重新打开相关问题的
关键词列表。
关键词列表。
- `DEFAULT_MERGE_STYLE`: **merge**: 设置创建仓库的默认合并方式,可选: `merge`, `rebase`, `rebase-merge`, `squash`, `fast-forward-only`
- `DEFAULT_MERGE_MESSAGE_COMMITS_LIMIT`: **50**: 在默认合并消息中,对于`squash`提交,最多包括此数量的提交。设置为 -1 以包括所有提交。
- `DEFAULT_MERGE_MESSAGE_SIZE`: **5120**: 在默认的合并消息中,对于`squash`提交,限制提交消息的大小。设置为 `-1`以取消限制。仅在`POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES`为`true`时使用。
@@ -137,18 +134,18 @@ aliases:
- `DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY`: **true**: 在默认合并消息中,仅包括官方允许审查的审批者。
- `POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES`: **false**: 在默认的 squash 合并消息中,包括构成拉取请求的所有提交的提交消息。
- `ADD_CO_COMMITTER_TRAILERS`: **true**: 如果提交者与作者不匹配,在合并提交消息中添加`co-authored-by`和`co-committed-by`标记。
- `TEST_CONFLICTING_PATCHES_WITH_GIT_APPLY`:使用三方合并方法测试`PR Patch`以发现是否存在冲突。如果此设置`true`,将使用`git apply`重新测试冲突的`PR Pathch` - 这是1.18(和之前版本)中的先前行为,但效率相对较低。如果发现需要此设置,请报告。
- `TEST_CONFLICTING_PATCHES_WITH_GIT_APPLY`:使用三方合并方法测试`PR Patch`以发现是否存在冲突。如果此设置`true`,将使用`git apply`重新测试冲突的`PR Pathch` - 这是 1.18(和之前版本)中的先前行为,但效率相对较低。如果发现需要此设置,请报告。
### 仓库 - 工单 (`repository.issue`)
- `LOCK_REASONS`: **Too heated,Off-topic,Resolved,Spam**: 合并请求或工单被锁定的原因列表。
- `MAX_PINNED`: **3**: 每个仓库的最大可固定工单数量。设置为0禁用固定工单。
- `MAX_PINNED`: **3**: 每个仓库的最大可固定工单数量。设置为 0 禁用固定工单。
### 仓库 - 文件上传 (`repository.upload`)
- `ENABLED`: **true**: 是否启用仓库文件上传。
- `TEMP_PATH`: **data/tmp/uploads**: 文件上传的临时保存路径(在Gitea重启的时候该目录会被清空)。
- `ALLOWED_TYPES`: **_empty_**: 以逗号分割的列表,代表支持上传的文件类型。(`.zip`), mime类型 (`text/plain`) or 通配符类型 (`image/*`, `audio/*`, `video/*`). 为空或者 `*/*`代表允许所有类型文件。
- `TEMP_PATH`: **data/tmp/uploads**: 文件上传的临时保存路径(在 Gitea 重启的时候该目录会被清空)。
- `ALLOWED_TYPES`: **_empty_**: 以逗号分割的列表,代表支持上传的文件类型。(`.zip`), mime 类型 (`text/plain`) or 通配符类型 (`image/*`, `audio/*`, `video/*`). 为空或者 `*/*`代表允许所有类型文件。
- `FILE_MAX_SIZE`: **50**: 每个文件的最大大小(MB)。
- `MAX_FILES`: **5**: 每次上传的最大文件数。
@@ -170,10 +167,10 @@ aliases:
- 除了 never 和 always 之外的选项可以组合为逗号分隔的列表。
- `DEFAULT_TRUST_MODEL`: **collaborator**: \[collaborator, committer, collaboratorcommitter\]: 用于验证提交的默认信任模型。
- `collaborator`: 信任协作者密钥签名的签名。
- `committer`: 信任与提交者匹配的签名这与GitHub匹配并会强制Gitea签名的提交具有Gitea作为提交者
- `committer`: 信任与提交者匹配的签名(这与 GitHub 匹配,并会强制 Gitea 签名的提交具有 Gitea 作为提交者)。
- `collaboratorcommitter`: 信任与提交者匹配的协作者密钥签名的签名。
- `WIKI`: **never**: \[never, pubkey, twofa, always, parentsigned\]: 对wiki提交进行签名。
- `CRUD_ACTIONS`: **pubkey, twofa, parentsigned**: \[never, pubkey, twofa, parentsigned, always\]: 对CRUD操作进行签名。
- `WIKI`: **never**: \[never, pubkey, twofa, always, parentsigned\]: 对 wiki 提交进行签名。
- `CRUD_ACTIONS`: **pubkey, twofa, parentsigned**: \[never, pubkey, twofa, parentsigned, always\]: 对 CRUD 操作进行签名。
- 与上面相同的选项,增加了:
- `parentsigned`: 仅在父提交进行了签名时才进行签名。
- `MERGES`: **pubkey, twofa, basesigned, commitssigned**: \[never, pubkey, twofa, approved, basesigned, commitssigned, always\]: 对合并操作进行签名。
@@ -186,7 +183,7 @@ aliases:
- `LOCAL_COPY_PATH`: **tmp/local-repo**:临时本地仓库副本的路径。默认为 tmp/local-repo内容在 Gitea 重新启动时被删除)
### 仓库 - MIME type mapping (`repository.mimetype_mapping`)
### 仓库 - MIME type mapping (`repository.mimetype_mapping`)
配置用于根据可下载文件的文件扩展名设置预期的 MIME 类型。配置以键值对的形式呈现,文件扩展名以`.`开头。
@@ -204,7 +201,7 @@ aliases:
- `MAX_AGE`: **10m**: 缓存响应的最大时间
- `ALLOW_CREDENTIALS`: **false**: 允许带有凭据的请求
- `HEADERS`: **Content-Type,User-Agent**: 允许请求携带的头部
- `X_FRAME_OPTIONS`: **SAMEORIGIN**: 详见 `X-Frame-Options`HTTP头部.
- `X_FRAME_OPTIONS`: **SAMEORIGIN**: 详见 `X-Frame-Options`HTTP 头部.
## 界面 (`ui`)
@@ -213,23 +210,23 @@ aliases:
- `MEMBERS_PAGING_NUM`: **20**: 组织成员页面每页显示的成员数量。
- `FEED_MAX_COMMIT_NUM`: **5**: 活动流页面显示的最大提交数量。
- `FEED_PAGING_NUM`: **20**: 活动流页面显示的最大活动数量。
- `SITEMAP_PAGING_NUM`: **20**: 在单个子SiteMap中显示的项数。
- `GRAPH_MAX_COMMIT_NUM`: **100**: 提交图中显示的最大commit数量。
- `SITEMAP_PAGING_NUM`: **20**: 在单个子 SiteMap 中显示的项数。
- `GRAPH_MAX_COMMIT_NUM`: **100**: 提交图中显示的最大 commit 数量。
- `CODE_COMMENT_LINES`: **4**: 在代码评论中能够显示的最大代码行数。
- `DEFAULT_THEME`: **gitea-auto**: 在Gitea安装时候设置的默认主题自定义的主题可以通过 `{CustomPath}/public/assets/css/theme-*.css` 提供。
- `DEFAULT_THEME`: **gitea-auto**: 在 Gitea 安装时候设置的默认主题,自定义的主题可以通过 `{CustomPath}/public/assets/css/theme-*.css` 提供。
- `SHOW_USER_EMAIL`: **true**: 用户的电子邮件是否应该显示在`Explore Users`页面中。
- `THEMES`: **_empty_**: 所有可用的主题(由 `{CustomPath}/public/assets/css/theme-*.css` 提供)。允许用户选择个性化的主题,
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: 能够显示文件的最大大小默认为8MiB
- `THEMES`: **_empty_**: 所有可用的主题(由 `{CustomPath}/public/assets/css/theme-*.css` 提供)。允许用户选择个性化的主题,
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: 能够显示文件的最大大小(默认为 8MiB
- `REACTIONS`: 用户可以在问题Issue、Pull RequestPR以及评论中选择的所有可选的反应。
这些值可以是表情符号别名(例如::smile:或Unicode表情符号。
对于自定义的反应,在 public/assets/img/emoji/ 目录下添加一个紧密裁剪的正方形图像,文件名为 reaction_name.png。
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: 不在utf8标准中定义的额外表情符号。
默认情况下,我们支持 Gitea 表情符号(:gitea:)。要添加更多表情符号,请将它们复制到 public/assets/img/emoji/ 目录下,
并将其添加到此配置中。
这些值可以是表情符号别名(例如::smile:)或 Unicode 表情符号。
对于自定义的反应,在 public/assets/img/emoji/ 目录下添加一个紧密裁剪的正方形图像,文件名为 reaction_name.png。
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: 不在 utf8 标准中定义的额外表情符号。
默认情况下,我们支持 Gitea 表情符号(:gitea:)。要添加更多表情符号,请将它们复制到 public/assets/img/emoji/ 目录下,
并将其添加到此配置中。
- `DEFAULT_SHOW_FULL_NAME`: **false**: 是否在可能的情况下显示用户的全名。如果没有设置全名,则将使用用户名。
- `SEARCH_REPO_DESCRIPTION`: **true**: 是否在探索页面上的仓库搜索中搜索描述。
- `ONLY_SHOW_RELEVANT_REPOS`: **false** 在没有指定关键字并使用默认排序时,是否仅在探索页面上显示相关的仓库。
如果一个仓库是分叉或者没有元数据(没有描述、图标、主题),则被视为不相关的仓库。
如果一个仓库是分叉或者没有元数据(没有描述、图标、主题),则被视为不相关的仓库。
### 界面 - 管理员 (`ui.admin`)
@@ -258,11 +255,11 @@ aliases:
### 界面 - SVG Images (`ui.svg`)
- `ENABLE_RENDER`: **true**: 是否将SVG文件呈现为图像。如果禁用了SVG渲染SVG文件将显示为文本无法作为图像嵌入到Markdown文件中。
- `ENABLE_RENDER`: **true**: 是否将 SVG 文件呈现为图像。如果禁用了 SVG 渲染SVG 文件将显示为文本,无法作为图像嵌入到 Markdown 文件中。
### 界面 - CSV Files (`ui.csv`)
- `MAX_FILE_SIZE`: **524288** (512kb): 以字节为单位允许将CSV文件呈现为表格的最大文件大小将其设置为0表示没有限制)。
- `MAX_FILE_SIZE`: **524288** (512kb): 以字节为单位允许将 CSV 文件呈现为表格的最大文件大小(将其设置为 0 表示没有限制)。
- `MAX_ROWS`: **2500** : 最大允许的 CSV 文件行数。 (设置为 0 不限制)
## Markdown (`markdown`)
@@ -273,10 +270,10 @@ aliases:
- `ENABLE_HARD_LINE_BREAK_IN_DOCUMENTS`: **false**: 在文档中将软换行符呈现为硬换行符,
这意味着段落之间的单个换行符将导致换行,
并且不需要在段落后添加尾随空格来强制换行。
- `CUSTOM_URL_SCHEMES`: 使用逗号分隔的列表ftp、git、svn来指示要在Markdown中呈现的附加URL超链接。
以httphttps开头的URL始终显示。
如果此条目为空则允许所有URL方案。
- `FILE_EXTENSIONS`: **.md,.markdown,.mdown,.mkd,.livemd**: 应呈现/编辑为Markdown的文件扩展名列表。使用逗号分隔扩展名。要将没有任何扩展名的文件呈现为Markdown请只需放置一个逗号。
- `CUSTOM_URL_SCHEMES`: 使用逗号分隔的列表ftp、git、svn来指示要在 Markdown 中呈现的附加 URL 超链接。
httphttps 开头的 URL 始终显示。
如果此条目为空,则允许所有 URL 方案。
- `FILE_EXTENSIONS`: **.md,.markdown,.mdown,.mkd,.livemd**: 应呈现/编辑为 Markdown 的文件扩展名列表。使用逗号分隔扩展名。要将没有任何扩展名的文件呈现为 Markdown请只需放置一个逗号。
- `ENABLE_MATH`: **true**: 启用对`\(...\)`, `\[...\]`, `$...$`和`$$...$$` 作为数学块的检测。
## 服务器 (`server`)
@@ -289,26 +286,30 @@ aliases:
- `PROXY_PROTOCOL_ACCEPT_UNKNOWN`: **false**:接受带有未知类型的`PROXY`协议头。
- `DOMAIN`: **localhost**: 此服务器的域名。
- `ROOT_URL`: **`{PROTOCOL}://{DOMAIN}:{HTTP_PORT}/`**:
覆盖自动生成的公共URL。
如果内部URL和外部URL不匹配例如在Docker中这很有用
覆盖自动生成的公共 URL。
这个选项用于内部 URL 和外部 URL 不匹配的情况(例如 Gitea 运行在反向代理后)
- `PUBLIC_URL_DETECTION`: **`legacy`**: 控制如何生成公共 URL。
虽然它的默认值是 "legacy"(避免影响老的用户),大多数实例都应当使用 "auto" 行为,尤其是 Gitea 实例需要在容器网络中被访问的场景。
- "legacy": 当 "X-Forwarded-Proto" 请求头存在的时候,使用 "Host" 请求头生成公共 URL否则使用 "ROOT_URL"。
- "auto": 总是使用 "Host" 请求头生成公共 URL如果 "X-Forwarded-Proto" 请求头存在也会使用它。如果没有 "Host" 请求头则使用 "ROOT_URL"。
- `STATIC_URL_PREFIX`: **_empty_**:
覆盖此选项以从不同的URL请求静态资源。
这包括CSS文件、图片、JS文件和Web字体。
头像图片是动态资源仍由Gitea提供。
选项可以是不同的路径,例如`/static`, 也可以是另一个域,例如`https://cdn.example.com`.
请求会变成 `{ROOT_URL}/static/assets/css/index.css` 或 `https://cdn.example.com/assets/css/index.css`
静态文件位于Gitea源代码仓库的`public/`目录中。
您可以将`STATIC_URL_PREFIX`请求代理到 Gitea 服务器以提供静态资源,或者将手动构建的 Gitea 资源从 `$GITEA_BUILD/public`复制到静态位置,例如`/var/www/assets`。确保`$STATIC_URL_PREFIX/assets/css/index.css`指向`/var/www/assets/css/index.css`。
覆盖此选项以从不同的 URL 请求静态资源。
这包括 CSS 文件、图片、JS 文件和 Web 字体。
头像图片是动态资源,仍由 Gitea 提供。
选项可以是不同的路径,例如`/static`, 也可以是另一个域,例如`https://cdn.example.com`.
请求会变成 `{ROOT_URL}/static/assets/css/index.css` 或 `https://cdn.example.com/assets/css/index.css`
静态文件位于 Gitea 源代码仓库的`public/`目录中。
您可以将`STATIC_URL_PREFIX`请求代理到 Gitea 服务器以提供静态资源,或者将手动构建的 Gitea 资源从 `$GITEA_BUILD/public`复制到静态位置,例如`/var/www/assets`。确保`$STATIC_URL_PREFIX/assets/css/index.css`指向`/var/www/assets/css/index.css`。
- `HTTP_ADDR`: **0.0.0.0**: HTTP 监听地址。
- 如果 `PROTOCOL` 设置为 `fcgi`Gitea 将在由
`HTTP_ADDR` 和 `HTTP_PORT` 配置设置定义的 TCP 套接字上监听 FastCGI 请求。
`HTTP_ADDR` 和 `HTTP_PORT` 配置设置定义的 TCP 套接字上监听 FastCGI 请求。
- 如果 `PROTOCOL` 设置为 `http+unix` 或 `fcgi+unix`,则应该是要使用的 Unix 套接字文件的名称。相对路径将相对于 _`AppWorkPath`_ 被转换为绝对路径。
- `HTTP_PORT`: **3000**: HTTP 监听端口。
- 如果 `PROTOCOL` 设置为 `fcgi`Gitea 将在由 `HTTP_ADDR` 和 `HTTP_PORT`
配置设置定义的 TCP 套接字上监听 FastCGI 请求。
配置设置定义的 TCP 套接字上监听 FastCGI 请求。
- `UNIX_SOCKET_PERMISSION`: **666**: Unix 套接字的权限。
- `LOCAL_ROOT_URL`: **`{PROTOCOL}://{HTTP_ADDR}:{HTTP_PORT}/`**:
- `LOCAL_ROOT_URL`: **`{PROTOCOL}://{HTTP_ADDR}:{HTTP_PORT}/`**:
用于访问网络服务的 Gitea 工作器(例如 SSH 更新的本地DMZURL。
在大多数情况下,您不需要更改默认值。
仅在您的 SSH 服务器节点与 HTTP 节点不同的情况下才修改它。对于不同的协议,默认值不同。如果 `PROTOCOL`
@@ -317,15 +318,15 @@ aliases:
`{PROTOCOL}://localhost:{HTTP_PORT}/`
否则默认值为 `{PROTOCOL}://{HTTP_ADDR}:{HTTP_PORT}/`。
- `LOCAL_USE_PROXY_PROTOCOL`: **`{USE_PROXY_PROTOCOL}`**: 在进行本地连接时传递 PROXY 协议头。
如果本地连接将经过代理,请将其设置为 false。
如果本地连接将经过代理,请将其设置为 false。
- `PER_WRITE_TIMEOUT`: **30s**: 连接的任何写操作的超时时间。(将其设置为 -1
以禁用所有超时。)
- `PER_WRITE_PER_KB_TIMEOUT`: **10s**: 连接每写入 1 KB 的超时时间。
- `DISABLE_SSH`: **false**: 当SSH不可用时禁用SSH功能。
- `START_SSH_SERVER`: **false**: 启用时使用内置的SSH服务器。
- `SSH_SERVER_USE_PROXY_PROTOCOL`: **false**: 在与内置SSH服务器建立连接时期望PROXY协议头。
- `BUILTIN_SSH_SERVER_USER`: **`{RUN_USER}`**: 用于内置SSH服务器的用户名。
- `SSH_USER`: **BUILTIN_SSH_SERVER_USER**: 在克隆URL中显示的SSH用户名。
- `DISABLE_SSH`: **false**: 当 SSH 不可用时禁用 SSH 功能。
- `START_SSH_SERVER`: **false**: 启用时,使用内置的 SSH 服务器。
- `SSH_SERVER_USE_PROXY_PROTOCOL`: **false**: 在与内置 SSH 服务器建立连接时,期望 PROXY 协议头。
- `BUILTIN_SSH_SERVER_USER`: **`{RUN_USER}`**: 用于内置 SSH 服务器的用户名。
- `SSH_USER`: **BUILTIN_SSH_SERVER_USER**: 在克隆 URL 中显示的 SSH 用户名。
如果设置为 `(DOER_USERNAME)`,将使用当前登录用户名作为克隆用的 SSH 用户名。
此配置项仅为自己配置 SSH 反向代理的高级用户准备,
大多数用户应当把它留空,或者按需修改 `BUILTIN_SSH_SERVER_USER`。
@@ -421,7 +422,7 @@ aliases:
## 数据库 (`database`)
- `DB_TYPE`: **mysql**: 数据库类型 \[mysql, postgres, mssql, sqlite3\]。
- `HOST`: **127.0.0.1:3306**: 数据库主机地址和端口或unix套接字的绝对路径 \[mysql, postgres\](例如:/var/run/mysqld/mysqld.sock
- `HOST`: **127.0.0.1:3306**: 数据库主机地址和端口或 unix 套接字的绝对路径 \[mysql, postgres\](例如:/var/run/mysqld/mysqld.sock
- `NAME`: **gitea**: 数据库名称。
- `USER`: **root**: 数据库用户名。
- `PASSWD`: **_empty_**: 数据库密码。如果密码包含特殊字符,请使用 \`your password\` 或 """your password"""。
@@ -455,15 +456,15 @@ aliases:
## 索引 (`indexer`)
- `ISSUE_INDEXER_TYPE`: **bleve**: 工单索引类型,当前支持:`bleve``db``elasticsearch``meilisearch`
- `ISSUE_INDEXER_CONN_STR`**** : 工单索引连接字符串,仅适用于 elasticsearch 和 meilisearch例如`http://elastic:password@localhost:9200`)或者(例如:`http://:apikey@localhost:7700`)。
- `ISSUE_INDEXER_CONN_STR`\*\*\*\* : 工单索引连接字符串,仅适用于 elasticsearch 和 meilisearch例如`http://elastic:password@localhost:9200`)或者(例如:`http://:apikey@localhost:7700`)。
- `ISSUE_INDEXER_NAME`**gitea_issues**: 工单索引器名称,在 ISSUE_INDEXER_TYPE 为 elasticsearch 或 meilisearch 时可用。
- `ISSUE_INDEXER_PATH`**indexers/issues.bleve**: 用于工单搜索的索引文件;在 ISSUE_INDEXER_TYPE 为 bleve 和 elasticsearch 时可用。相对路径将相对于 _`AppWorkPath`_ 进行绝对路径化。
- `ISSUE_INDEXER_PATH`**indexers/issues.bleve**: 用于工单搜索的索引文件;在 ISSUE*INDEXER_TYPE 为 bleve 和 elasticsearch 时可用。相对路径将相对于 *`AppWorkPath`\_ 进行绝对路径化。
- `REPO_INDEXER_ENABLED`**false**: 启用代码搜索(占用大量磁盘空间,约为存储库大小的 6 倍)。
- `REPO_INDEXER_REPO_TYPES`**sources,forks,mirrors,templates**: 存储库索引器单元。要索引的项目可以是 `sources``forks``mirrors``templates` 或它们的任何组合,用逗号分隔。如果为空,则默认为仅 `sources`,如果要完全禁用,请参见 `REPO_INDEXER_ENABLED`
- `REPO_INDEXER_TYPE`**bleve**: 代码搜索引擎类型,可以为 `bleve` 或者 `elasticsearch`
- `REPO_INDEXER_PATH`**indexers/repos.bleve**: 用于代码搜索的索引文件。
- `REPO_INDEXER_CONN_STR`****: 代码索引器连接字符串,在 `REPO_INDEXER_TYPE` 为 elasticsearch 时可用。例如:`http://elastic:password@localhost:9200`
- `REPO_INDEXER_CONN_STR`\*\*\*\*: 代码索引器连接字符串,在 `REPO_INDEXER_TYPE` 为 elasticsearch 时可用。例如:`http://elastic:password@localhost:9200`
- `REPO_INDEXER_NAME`**gitea_codes**: 代码索引器名称,在 `REPO_INDEXER_TYPE` 为 elasticsearch 时可用。
- `REPO_INDEXER_INCLUDE`**empty**: 逗号分隔的 glob 模式列表(参见 [https://github.com/gobwas/glob](https://github.com/gobwas/glob))以用于**包括**在索引中。使用 `**.txt` 匹配任何具有 .txt 扩展名的文件。空列表表示包括所有文件。
@@ -481,8 +482,8 @@ aliases:
- `LENGTH`**100000**: 通道队列阻塞之前的最大队列大小
- `BATCH_LENGTH`**20**: 在传递给处理程序之前批处理数据
- `CONN_STR`**redis://127.0.0.1:6379/0**: redis 队列类型的连接字符串。对于 `redis-cluster`,使用 `redis+cluster://127.0.0.1:6379/0`。可以使用查询参数来设置选项。类似地LevelDB 选项也可以使用:**leveldb://relative/path?option=value** 或 **leveldb:///absolute/path?option=value** 进行设置,并将覆盖 `DATADIR`
- `QUEUE_NAME`**_queue**: 默认的 redis 和磁盘队列名称的后缀。单独的队列将默认为 **`name`**`QUEUE_NAME`,但可以在特定的 `queue.name` 部分中进行覆盖。
- `SET_NAME`**_unique**: 将添加到默认的 redis 和磁盘队列 `set` 名称中以用于唯一队列的后缀。单独的队列将默认为 **`name`**`QUEUE_NAME`_`SET_NAME`_但可以在特定的 `queue.name` 部分中进行覆盖。
- `QUEUE_NAME`**\_queue**: 默认的 redis 和磁盘队列名称的后缀。单独的队列将默认为 **`name`**`QUEUE_NAME`,但可以在特定的 `queue.name` 部分中进行覆盖。
- `SET_NAME`**\_unique**: 将添加到默认的 redis 和磁盘队列 `set` 名称中以用于唯一队列的后缀。单独的队列将默认为 **`name`**`QUEUE_NAME`_`SET_NAME`_但可以在特定的 `queue.name` 部分中进行覆盖。
- `MAX_WORKERS`**(dynamic)**: 队列的最大工作协程数。默认值为 "CpuNum/2",限制在 1 到 10 之间。
Gitea 创建以下非唯一队列:
@@ -506,8 +507,8 @@ Gitea 创建以下非唯一队列:
- `DEFAULT_EMAIL_NOTIFICATIONS`: **enabled**: 用户电子邮件通知的默认配置用户可配置。选项enabled、onmention、disabled
- `DISABLE_REGULAR_ORG_CREATION`: **false**: 禁止普通(非管理员)用户创建组织。
- `USER_DISABLED_FEATURES`:**_empty_** 禁用的用户特性,当前允许为空或者 `deletion``manage_ssh_keys` `manage_gpg_keys` 未来可以增加更多设置。
- `deletion`: 用户不能通过界面或者API删除他自己。
- `manage_ssh_keys`: 用户不能通过界面或者API配置SSH Keys。
- `deletion`: 用户不能通过界面或者 API 删除他自己。
- `manage_ssh_keys`: 用户不能通过界面或者 API 配置 SSH Keys。
- `manage_gpg_keys`: 用户不能配置 GPG 密钥。
## 安全性 (`security`)
@@ -516,19 +517,19 @@ Gitea 创建以下非唯一队列:
- `SECRET_KEY`: **\<每次安装时随机生成\>**: 全局服务器安全密钥。这个密钥非常重要,如果丢失将无法解密加密的数据(例如 2FA
- `SECRET_KEY_URI`: **_empty_**: 与定义 `SECRET_KEY` 不同,此选项可用于使用存储在文件中的密钥(示例值:`file:/etc/gitea/secret_key`)。它不应该像 `SECRET_KEY` 一样容易丢失。
- `LOGIN_REMEMBER_DAYS`: **31**: 在要求重新登录之前,记住用户的登录状态多长时间(以天为单位)。
- `COOKIE_REMEMBER_NAME`: **gitea\_incredible**: 保存自动登录信息的 Cookie 名称。
- `COOKIE_REMEMBER_NAME`: **gitea_incredible**: 保存自动登录信息的 Cookie 名称。
- `REVERSE_PROXY_AUTHENTICATION_USER`: **X-WEBAUTH-USER**: 反向代理认证的 HTTP 头部名称,用于提供用户信息。
- `REVERSE_PROXY_AUTHENTICATION_EMAIL`: **X-WEBAUTH-EMAIL**: 反向代理认证的 HTTP 头部名称,用于提供邮箱信息。
- `REVERSE_PROXY_AUTHENTICATION_FULL_NAME`: **X-WEBAUTH-FULLNAME**: 反向代理认证的 HTTP 头部名称,用于提供全名信息。
- `REVERSE_PROXY_LIMIT`: **1**: 解释 X-Forwarded-For 标头或 X-Real-IP 标头,并将其设置为请求的远程 IP。
可信代理计数。设置为零以不使用这些标头。
可信代理计数。设置为零以不使用这些标头。
- `REVERSE_PROXY_TRUSTED_PROXIES`: **127.0.0.0/8,::1/128**: 逗号分隔的受信任代理服务器的 IP 地址和网络列表。使用 `*` 来信任全部。
- `DISABLE_GIT_HOOKS`: **true**: 设置为 `false` 以允许具有 Git 钩子权限的用户创建自定义 Git 钩子。
警告:自定义 Git 钩子可用于在主机操作系统上执行任意代码。这允许用户访问和修改此配置文件和 Gitea 数据库,并中断 Gitea 服务。
通过修改 Gitea 数据库,用户可以获得 Gitea 管理员权限。
它还使他们可以访问正在运行 Gitea 实例的操作系统上用户可用的其他资源,并以 Gitea 操作系统用户的名义执行任意操作。
这可能对您的网站或操作系统造成危害。
在必要之前,请在更改现有 git 存储库中的钩子之前进行调整。
警告:自定义 Git 钩子可用于在主机操作系统上执行任意代码。这允许用户访问和修改此配置文件和 Gitea 数据库,并中断 Gitea 服务。
通过修改 Gitea 数据库,用户可以获得 Gitea 管理员权限。
它还使他们可以访问正在运行 Gitea 实例的操作系统上用户可用的其他资源,并以 Gitea 操作系统用户的名义执行任意操作。
这可能对您的网站或操作系统造成危害。
在必要之前,请在更改现有 git 存储库中的钩子之前进行调整。
- `DISABLE_WEBHOOKS`: **false**: 设置为 `true` 以禁用 Webhooks 功能。
- `ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET`: **true**: 设置为 `false` 以允许本地用户在未设置 Gitea 环境的情况下推送到 Gitea 存储库。不建议这样做,如果您希望本地用户推送到 Gitea 存储库,应该适当地设置环境。
- `IMPORT_LOCAL_PATHS`: **false**: 设置为 `false` 以防止所有用户(包括管理员)从服务器上导入本地路径。
@@ -556,7 +557,7 @@ Gitea 创建以下非唯一队列:
- lower - 使用一个或多个小写拉丁字符
- upper - 使用一个或多个大写拉丁字符
- digit - 使用一个或多个数字
- spec - 使用一个或多个特殊字符,如 ``!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``
- spec - 使用一个或多个特殊字符,如 `` !"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ``
- off - 不检查密码复杂性
- `PASSWORD_CHECK_PWN`: **false**: 检查密码是否在 [HaveIBeenPwned](https://haveibeenpwned.com/Passwords) 中曝光。
- `SUCCESSFUL_TOKENS_CACHE_SIZE`: **20**: 缓存成功的令牌哈希。API 令牌在数据库中存储为 pbkdf2 哈希,但这意味着在存在多个 API 操作时可能会有显着的哈希负载。此缓存将在 LRU 缓存中存储成功的哈希令牌,以在性能和安全性之间保持平衡。
@@ -564,27 +565,27 @@ Gitea 创建以下非唯一队列:
## Camo (`camo`)
- `ENABLED`: **false**: 启用媒体代理,目前仅支持图像。
- `SERVER_URL`: **_empty_**: Camo服务器的URL如果启用camo则**必填**。
- `HMAC_KEY`: **_empty_**: 为URL编码提供HMAC密钥如果启用camo则**必填**。
- `ALWAYS`: **false**: 设置为true以在HTTPHTTPS内容上使用camo否则仅代理非HTTPS URL。`ALLWAYS` 已经过期,并且会在未来版本中删除。
- `SERVER_URL`: **_empty_**: Camo 服务器的 URL如果启用 camo则**必填**。
- `HMAC_KEY`: **_empty_**: 为 URL 编码提供 HMAC 密钥,如果启用 camo则**必填**。
- `ALWAYS`: **false**: 设置为 true 以在 HTTPHTTPS 内容上使用 camo否则仅代理非 HTTPS URL。`ALLWAYS` 已经过期,并且会在未来版本中删除。
## OpenID (`openid`)
- `ENABLE_OPENID_SIGNIN`: **true**: 允许通过OpenID进行身份验证。
- `ENABLE_OPENID_SIGNUP`: **! DISABLE\_REGISTRATION**: 允许通过OpenID进行注册。
- `WHITELISTED_URIS`: **_empty_**: 如果非空是一组匹配OpenID URIPOSIX正则表达式模式用于允许访问。
- `BLACKLISTED_URIS`: **_empty_**: 如果非空是一组匹配OpenID URIPOSIX正则表达式模式用于阻止访问。
- `ENABLE_OPENID_SIGNIN`: **true**: 允许通过 OpenID 进行身份验证。
- `ENABLE_OPENID_SIGNUP`: **! DISABLE_REGISTRATION**: 允许通过 OpenID 进行注册。
- `WHITELISTED_URIS`: **_empty_**: 如果非空,是一组匹配 OpenID URIPOSIX 正则表达式模式,用于允许访问。
- `BLACKLISTED_URIS`: **_empty_**: 如果非空,是一组匹配 OpenID URIPOSIX 正则表达式模式,用于阻止访问。
## OAuth2 Client (`oauth2_client`)
- `REGISTER_EMAIL_CONFIRM`: _[service]_ **REGISTER\_EMAIL\_CONFIRM**: 设置此项以启用或禁用OAuth2自动注册的电子邮件确认。覆盖`[service]`部分的`REGISTER\_EMAIL\_CONFIRM`设置)
- `OPENID_CONNECT_SCOPES`: **_empty_**: 附加的OpenID连接范围的列表。`openid`已隐式添加)
- `ENABLE_AUTO_REGISTRATION`: **false**: 为新的OAuth2用户自动创建用户帐户。
- `USERNAME`: **nickname**: 新OAuth2帐户的用户名来源
- userid - 使用userid / sub属性
- nickname - 使用nickname属性
- email - 使用email属性的用户名部分
- `UPDATE_AVATAR`: **false**: 如果OAuth2提供程序中有可用的头像则进行头像更新。更新将在每次登录时执行。
- `REGISTER_EMAIL_CONFIRM`: _[service]_ **REGISTER_EMAIL_CONFIRM**: 设置此项以启用或禁用 OAuth2 自动注册的电子邮件确认。(覆盖`[service]`部分的`REGISTER\_EMAIL\_CONFIRM`设置)
- `OPENID_CONNECT_SCOPES`: **_empty_**: 附加的 OpenID 连接范围的列表。(`openid`已隐式添加)
- `ENABLE_AUTO_REGISTRATION`: **false**: 为新的 OAuth2 用户自动创建用户帐户。
- `USERNAME`: **nickname**: 新 OAuth2 帐户的用户名来源:
- userid - 使用 userid / sub 属性
- nickname - 使用 nickname 属性
- email - 使用 email 属性的用户名部分
- `UPDATE_AVATAR`: **false**: 如果 OAuth2 提供程序中有可用的头像,则进行头像更新。更新将在每次登录时执行。
- `ACCOUNT_LINKING`: **login**: 如果帐户/电子邮件已存在,如何处理:
- disabled - 显示错误
- login - 显示帐户链接登录
@@ -597,54 +598,54 @@ Gitea 创建以下非唯一队列:
- `REGISTER_EMAIL_CONFIRM`: **false**: 启用此项以要求通过邮件确认注册。需要启用`Mailer`
- `REGISTER_MANUAL_CONFIRM`: **false**: 启用此项以手动确认新的注册。需要禁用`REGISTER_EMAIL_CONFIRM`
- `DISABLE_REGISTRATION`: **false**: 禁用注册,之后只有管理员可以为用户创建帐户。
- `REQUIRE_EXTERNAL_REGISTRATION_PASSWORD`: **false**: 启用此项以强制通过外部方式创建的帐户通过GitHub、OpenID Connect等创建密码。警告启用此项将降低安全性因此只有在您知道自己在做什么时才应启用它。
- `REQUIRE_SIGNIN_VIEW`: **false**: 启用此项以强制用户登录以查看任何页面或使用API。
- `REQUIRE_EXTERNAL_REGISTRATION_PASSWORD`: **false**: 启用此项以强制通过外部方式创建的帐户(通过 GitHub、OpenID Connect 等)创建密码。警告:启用此项将降低安全性,因此只有在您知道自己在做什么时才应启用它。
- `REQUIRE_SIGNIN_VIEW`: **false**: 启用此项以强制用户登录以查看任何页面或使用 API。
- `ENABLE_NOTIFY_MAIL`: **false**: 启用此项以在发生某些情况(如创建问题)时向存储库的观察者发送电子邮件。需要启用`Mailer`
- `ENABLE_BASIC_AUTHENTICATION`: **true**: 禁用此项以禁止使用HTTP BASIC和用户的密码进行身份验证。请注意如果禁用此项您将无法使用密码访问令牌API端点。此外这仅会禁用使用密码的BASIC身份验证而不会禁用令牌或OAuth Basic。
- `ENABLE_BASIC_AUTHENTICATION`: **true**: 禁用此项以禁止使用 HTTP BASIC 和用户的密码进行身份验证。请注意,如果禁用此项,您将无法使用密码访问令牌 API 端点。此外,这仅会禁用使用密码的 BASIC 身份验证,而不会禁用令牌或 OAuth Basic。
- `ENABLE_REVERSE_PROXY_AUTHENTICATION`: **false**: 启用此项以允许反向代理身份验证。
- `ENABLE_REVERSE_PROXY_AUTO_REGISTRATION`: **false**: 启用此项以允许反向身份验证的自动注册。
- `ENABLE_REVERSE_PROXY_EMAIL`: **false**: 启用此项以允许使用提供的电子邮件而不是生成的电子邮件进行自动注册。
- `ENABLE_REVERSE_PROXY_FULL_NAME`: **false**: 启用此项以允许使用提供的全名进行自动注册。
- `ENABLE_CAPTCHA`: **false**: 启用此项以对注册使用验证码验证。
- `REQUIRE_CAPTCHA_FOR_LOGIN`: **false**: 启用此项以要求登录使用验证码验证。您还必须启用`ENABLE_CAPTCHA`
- `REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA`: **false**: 启用此项以强制对外部帐户即GitHub、OpenID Connect等使用验证码验证。您还必须启用`ENABLE_CAPTCHA`
- `REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA`: **false**: 启用此项以强制对外部帐户(即 GitHub、OpenID Connect 等)使用验证码验证。您还必须启用`ENABLE_CAPTCHA`
- `CAPTCHA_TYPE`: **image**: \[image、recaptcha、hcaptcha、mcaptcha、cfturnstile\]
- `RECAPTCHA_SECRET`: **""**: 访问 https://www.google.com/recaptcha/admin 以获取recaptcha的密钥。
- `RECAPTCHA_SITEKEY`: **""**: 访问 https://www.google.com/recaptcha/admin 以获取recaptcha的站点密钥。
- `RECAPTCHA_URL`: **https://www.google.com/recaptcha/** 设置recaptcha网址允许使用recaptcha net。
- `HCAPTCHA_SECRET`: **""**: 注册 https://www.hcaptcha.com/ 以获取hcaptcha的密钥。
- `HCAPTCHA_SITEKEY`: **""**: 注册 https://www.hcaptcha.com/ 以获取hcaptcha的站点密钥。
- `MCAPTCHA_SECRET`: **""**: 访问您的mCaptcha实例以获取mCaptcha的密钥。
- `MCAPTCHA_SITEKEY`: **""**: 访问您的mCaptcha实例以获取mCaptcha的站点密钥。
- `MCAPTCHA_URL` **https://demo.mcaptcha.org/** 设置mCaptchaURL。
- `CF_TURNSTILE_SECRET` **""**: 访问 https://dash.cloudflare.com/?to=/:account/turnstile 以获取cloudflare turnstile的密钥。
- `CF_TURNSTILE_SITEKEY` **""**: 访问 https://dash.cloudflare.com/?to=/:account/turnstile 以获取cloudflare turnstile的站点密钥。
- `RECAPTCHA_SECRET`: **""**: 访问 https://www.google.com/recaptcha/admin 以获取 recaptcha 的密钥。
- `RECAPTCHA_SITEKEY`: **""**: 访问 https://www.google.com/recaptcha/admin 以获取 recaptcha 的站点密钥。
- `RECAPTCHA_URL`: **https://www.google.com/recaptcha/** :设置 recaptcha 网址,允许使用 recaptcha net。
- `HCAPTCHA_SECRET`: **""**: 注册 https://www.hcaptcha.com/ 以获取 hcaptcha 的密钥。
- `HCAPTCHA_SITEKEY`: **""**: 注册 https://www.hcaptcha.com/ 以获取 hcaptcha 的站点密钥。
- `MCAPTCHA_SECRET`: **""**: 访问您的 mCaptcha 实例以获取 mCaptcha 的密钥。
- `MCAPTCHA_SITEKEY`: **""**: 访问您的 mCaptcha 实例以获取 mCaptcha 的站点密钥。
- `MCAPTCHA_URL` **https://demo.mcaptcha.org/** :设置 mCaptchaURL。
- `CF_TURNSTILE_SECRET` **""**: 访问 https://dash.cloudflare.com/?to=/:account/turnstile 以获取 cloudflare turnstile 的密钥。
- `CF_TURNSTILE_SITEKEY` **""**: 访问 https://dash.cloudflare.com/?to=/:account/turnstile 以获取 cloudflare turnstile 的站点密钥。
- `DEFAULT_KEEP_EMAIL_PRIVATE`: **false**: 默认情况下,将用户设置为保持其电子邮件地址私有。
- `DEFAULT_ALLOW_CREATE_ORGANIZATION`: **true**: 默认情况下,允许新用户创建组织。
- `DEFAULT_USER_IS_RESTRICTED`: **false**: 默认情况下,为新用户分配受限权限。
- `DEFAULT_ENABLE_DEPENDENCIES`: **true**: 启用此项以默认启用依赖项。
- `ALLOW_CROSS_REPOSITORY_DEPENDENCIES` : **true** 启用此项以允许从用户被授予访问权限的任何存储库上进行依赖项操作。
- `USER_LOCATION_MAP_URL`: **""**: 一个显示用户在地图上位置的地图服务URL。位置将作为转义的查询参数附加到URL中。
- `USER_LOCATION_MAP_URL`: **""**: 一个显示用户在地图上位置的地图服务 URL。位置将作为转义的查询参数附加到 URL 中。
- `ENABLE_USER_HEATMAP`: **true**: 启用此项以在用户个人资料上显示热图。
- `ENABLE_TIMETRACKING`: **true**: 启用时间跟踪功能。
- `DEFAULT_ENABLE_TIMETRACKING`: **true**: 默认情况下,允许存储库默认使用时间跟踪。
- `DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME`: **true**: 仅允许具有写权限的用户跟踪时间。
- `EMAIL_DOMAIN_ALLOWLIST`: **_empty_**: 如果非空,逗号分隔的域名列表,只能用于在此实例上注册,支持通配符。
- `EMAIL_DOMAIN_BLOCKLIST`: **_empty_**: 如果非空,逗号分隔的域名列表,不能用于在此实例上注册,支持通配符。
- `SHOW_REGISTRATION_BUTTON`: **! DISABLE\_REGISTRATION**: 显示注册按钮
- `SHOW_REGISTRATION_BUTTON`: **! DISABLE_REGISTRATION**: 显示注册按钮
- `SHOW_MILESTONES_DASHBOARD_PAGE`: **true** 启用此项以显示里程碑仪表板页面 - 查看所有用户的里程碑
- `AUTO_WATCH_NEW_REPOS`: **true** 启用此项以在创建新存储库时让所有组织用户观看新存储库
- `AUTO_WATCH_ON_CHANGES`: **false** 启用此项以在首次提交后使用户观看存储库
- `DEFAULT_USER_VISIBILITY`: **public**: 为用户设置默认的可见性模式,可以是"public"、"limited"或"private"。
- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: 设置用户可以具有的可见性模式
- `DEFAULT_ORG_VISIBILITY`: **public**: 为组织设置默认的可见性模式,可以是"public"、"limited"或"private"。
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false**: 如果添加到组织时将用户的成员身份可见设置为True。
- `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false**: 设置为True以强制仅通过Gitea进行注册。
- `ALLOW_ONLY_EXTERNAL_REGISTRATION`: **false**: 设置为True以强制仅使用第三方服务进行注册。
- `NO_REPLY_ADDRESS`: **noreply.DOMAIN**: 如果用户将KeepEmailPrivate设置为True则在Git日志中的用户电子邮件地址的域部分的值。DOMAIN解析为server.DOMAIN中的值。
用户的电子邮件将被替换为小写的用户名、"@"和NO_REPLY_ADDRESS的连接。
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false**: 如果添加到组织时将用户的成员身份可见,设置为 True。
- `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false**: 设置为 True 以强制仅通过 Gitea 进行注册。
- `ALLOW_ONLY_EXTERNAL_REGISTRATION`: **false**: 设置为 True 以强制仅使用第三方服务进行注册。
- `NO_REPLY_ADDRESS`: **noreply.DOMAIN**: 如果用户将 KeepEmailPrivate 设置为 True则在 Git 日志中的用户电子邮件地址的域部分的值。DOMAIN 解析为 server.DOMAIN 中的值。
用户的电子邮件将被替换为小写的用户名、"@"和 NO_REPLY_ADDRESS 的连接。
- `USER_DELETE_WITH_COMMENTS_MAX_TIME`: **0**: 用户删除后,评论将保留的最短时间。
- `VALID_SITE_URL_SCHEMES`: **http, https**: 用户个人资料的有效站点URL方案
- `VALID_SITE_URL_SCHEMES`: **http, https**: 用户个人资料的有效站点 URL 方案
### Service - Explore (`service.explore`)
@@ -655,12 +656,12 @@ Gitea 创建以下非唯一队列:
## SSH Minimum Key Sizes (`ssh.minimum_key_sizes`)
定义允许的算法及其最小密钥长度(使用-1来禁用某个类型
定义允许的算法及其最小密钥长度(使用-1 来禁用某个类型):
- `ED25519`**256**
- `ECDSA`**256**
- `RSA`**3071**: 我们在这里设置为2047因为一个其他方面有效的3072 RSA密钥可能被报告为3071长度。
- `DSA`**-1**: 默认情况下禁用DSA。设置为**1024**以重新启用但请注意可能需要重新配置您的SSHD提供者
- `RSA`**3071**: 我们在这里设置为 2047因为一个其他方面有效的 3072 RSA 密钥可能被报告为 3071 长度。
- `DSA`**-1**: 默认情况下禁用 DSA。设置为**1024**以重新启用,但请注意可能需要重新配置您的 SSHD 提供者
## Webhook (`webhook`)
@@ -677,7 +678,7 @@ Gitea 创建以下非唯一队列:
- `SKIP_TLS_VERIFY`: **false**: 允许不安全的证书。
- `PAGING_NUM`: **10**: 一页中显示的 Webhook 历史事件数量。
- `PROXY_URL`: **_empty_**: 代理服务器 URL支持 http://、https://、socks://,留空将遵循环境的 http_proxy/https_proxy 设置。如果未提供,将使用全局代理设置。
- `PROXY_HOSTS`: **_empty_**: 需要代理的主机名的逗号分隔列表。支持通配符模式 (*);使用 ** 来匹配所有主机。如果未提供,将使用全局代理设置。
- `PROXY_HOSTS`: **_empty_**: 需要代理的主机名的逗号分隔列表。支持通配符模式 (\*);使用 \*\* 来匹配所有主机。如果未提供,将使用全局代理设置。
## 邮件 (`mailer`)
@@ -733,7 +734,7 @@ Gitea 创建以下非唯一队列:
## 缓存 (`cache`)
- `ADAPTER`: **memory**: 缓存引擎,可以为 `memory`, `redis`, `redis-cluster`, `twoqueue``memcache`. (`twoqueue` 代表缓冲区固定的LRU缓存)
- `ADAPTER`: **memory**: 缓存引擎,可以为 `memory`, `redis`, `redis-cluster`, `twoqueue``memcache`. (`twoqueue` 代表缓冲区固定的 LRU 缓存)
- `INTERVAL`: **60**: 垃圾回收间隔(秒),只对`memory``towqueue`有效。
- `HOST`: **_empty_**: 缓存配置。`redis`, `redis-cluster``memcache`配置连接字符串;`twoqueue` 设置队列参数
- Redis: `redis://:macaron@127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
@@ -752,7 +753,7 @@ Gitea 创建以下非唯一队列:
- `PROVIDER`: **memory**: 会话存储引擎 \[memory, file, redis, redis-cluster, db, mysql, couchbase, memcache, postgres\]。设置为 `db` 将会重用 `[database]` 的配置信息。
- `PROVIDER_CONFIG`: **data/sessions**: 对于文件,为根路径;对于 db为空将使用数据库配置对于其他引擎为连接字符串。相对路径将根据 _`AppWorkPath`_ 绝对化。
- `COOKIE_SECURE`: **_empty_**: `true``false`。启用此选项以强制在所有会话访问中使用 HTTPS。如果没有设置当 ROOT_URL 是 https 链接的时候默认设置为 true。
- `COOKIE_NAME`: **i\_like\_gitea**: 用于会话 ID 的 cookie 名称。
- `COOKIE_NAME`: **i_like_gitea**: 用于会话 ID 的 cookie 名称。
- `GC_INTERVAL_TIME`: **86400**: GC 间隔时间,以秒为单位。
- `SESSION_LIFE_TIME`: **86400**: 会话生命周期,以秒为单位,默认为 864001 天)。
- `DOMAIN`: **_empty_**: 设置 cookie 的域。
@@ -761,10 +762,10 @@ Gitea 创建以下非唯一队列:
## 图像 (`picture`)
- `GRAVATAR_SOURCE`: **gravatar**: 头像来源,可以是 gravatar、duoshuo 或类似 http://cn.gravatar.com/avatar/ 的来源。
`http://cn.gravatar.com/avatar/`
`http://cn.gravatar.com/avatar/`
- `DISABLE_GRAVATAR`: **false**: 启用后,只使用内部头像。**已弃用 [v1.18+]** 该配置已迁移到数据库中保存,通过管理员面板进行配置。
- `ENABLE_FEDERATED_AVATAR`: **false**: 启用头像联盟支持(参见
[http://www.libravatar.org](http://www.libravatar.org))。**已弃用 [v1.18+]** 该配置已迁移到数据库中保存,通过管理员面板进行配置。
[http://www.libravatar.org](http://www.libravatar.org))。**已弃用 [v1.18+]** 该配置已迁移到数据库中保存,通过管理员面板进行配置。
- `AVATAR_STORAGE_TYPE`: **default**: 在 `[storage.xxx]` 中定义的存储类型。默认为 `default`,如果没有 `[storage]` 部分,则将读取 `[storage]`,如果没有则将是 `local` 类型。
- `AVATAR_UPLOAD_PATH`: **data/avatars**: 存储用户头像图像文件的路径。
@@ -807,7 +808,7 @@ Gitea 创建以下非唯一队列:
- `MINIO_USE_SSL`: **false**: Minio 启用 SSL仅当 STORAGE_TYPE 为 `minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio 跳过 SSL 验证,仅当 STORAGE_TYPE 为 `minio` 时可用。
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio 校验算法:`default`(适用于 MinIO 或 AWS S3`md5`(适用于 Cloudflare 或 Backblaze
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket 查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
## 日志 (`log`)
@@ -834,7 +835,7 @@ Gitea 创建以下非唯一队列:
- 例如:
- 在请求头中X-Request-ID: **test-id-123**
- 在 app.ini 中的配置REQUEST_ID_HEADERS = X-Request-ID
- 在日志中打印127.0.0.1:58384 - - [14/Feb/2023:16:33:51 +0800] "**test-id-123**" ...
- 在日志中打印127.0.0.1:58384 - - [14/Feb/2023:16:33:51 +0800] "**test-id-123**" ...
### 日志子部分 (`log.<writer-mode-name>`)
@@ -870,13 +871,13 @@ Gitea 创建以下非唯一队列:
## 定时任务 (`cron`)
- `ENABLED`: **false**: 是否在后台运行定期任务。
- `ENABLED`: **false**: 是否在后台运行定期任务。
- `RUN_AT_START`: **false**: 在应用程序启动时运行定时任务。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true时任务成功完成时将进行通知。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 时,任务成功完成时将进行通知。
- `SCHEDULE` 接受的格式:
- 完整的crontab语法规范, e.g. `* * * * * ?`
- 描述符e.g. `@midnight`, `@every 1h30m` ...
- 完整的 crontab 语法规范, e.g. `* * * * * ?`
- 描述符 e.g. `@midnight`, `@every 1h30m` ...
- 更多详见: [cron documentation](https://pkg.go.dev/github.com/gogs/cron@v0.0.0-20171120032916-9f6c956d3e14)
### 基本定时任务 - 默认开启
@@ -885,31 +886,31 @@ Gitea 创建以下非唯一队列:
- `ENABLED`: **true**: 是否启用该定时任务。
- `RUN_AT_START`: **true**: 设置在服务启动时运行。
- `SCHEDULE`: **@midnight**: 使用Cron语法的定时任务触发配置例如 `@every 1h`
- `SCHEDULE`: **@midnight**: 使用 Cron 语法的定时任务触发配置,例如 `@every 1h`
- `OLDER_THAN`: **24h**: 超过`OLDER_THAN`时间的存档将被删除,例如 `12h`
#### 定时任务 - 更新镜像仓库 (`cron.update_mirrors`)
- `SCHEDULE`: **@every 10m**: 使用Cron语法的定时任务触发配置例如 `@every 3h`
- `PULL_LIMIT`: **50**: 将要添加到队列的镜像数量限制为此数字负值表示无限制0将导致不会将镜像加入队列从而有效地禁用镜像更新
- `PUSH_LIMIT`: **50**: 将要添加到队列的镜像数量限制为此数字负值表示无限制0将导致不会将镜像加入队列从而有效地禁用镜像更新
- `SCHEDULE`: **@every 10m**: 使用 Cron 语法的定时任务触发配置,例如 `@every 3h`
- `PULL_LIMIT`: **50**: 将要添加到队列的镜像数量限制为此数字负值表示无限制0 将导致不会将镜像加入队列,从而有效地禁用镜像更新)。
- `PUSH_LIMIT`: **50**: 将要添加到队列的镜像数量限制为此数字负值表示无限制0 将导致不会将镜像加入队列,从而有效地禁用镜像更新)。
#### 定时任务 - 健康检查所有仓库 (`cron.repo_health_check`)
- `SCHEDULE`: **@midnight**: Cron语法用于安排仓库健康检查。
- `SCHEDULE`: **@midnight**: Cron 语法,用于安排仓库健康检查。
- `TIMEOUT`: **60s**: 用于健康检查执行超时的时间持续语法。
- `ARGS`: **_empty_**: `git fsck` 命令的参数,例如 `--unreachable --tags`。在 http://git-scm.com/docs/git-fsck 上了解更多。
#### 定时任务 - 检查所有仓库统计 (`cron.check_repo_stats`)
- `RUN_AT_START`: **true**: 在启动时运行仓库统计检查。
- `SCHEDULE`: **@midnight**: Cron语法用于安排仓库统计检查。
- `SCHEDULE`: **@midnight**: Cron 语法,用于安排仓库统计检查。
#### 定时任务 - 清理 hook_task 表 (`cron.cleanup_hook_task_table`)
- `ENABLED`: **true**: 启用清理 hook_task 任务。
- `RUN_AT_START`: **false**: 在启动时运行清理 hook_task如果启用
- `SCHEDULE`: **@midnight**: Cron语法用于清理 hook_task 表。
- `SCHEDULE`: **@midnight**: Cron 语法,用于清理 hook_task 表。
- `CLEANUP_TYPE` **OlderThan** OlderThan 或 PerWebhook 方法来清理 hook_task可以按年龄即 hook_task 记录传递多久)或按每个 Webhook 保留的数量(即每个 Webhook 保留最新的 x 个传递)来清理。
- `OLDER_THAN`: **168h**: 如果 CLEANUP_TYPE 设置为 OlderThan则早于此表达式的任何传递的 hook_task 记录将被删除。
- `NUMBER_TO_KEEP`: **10**: 如果 CLEANUP_TYPE 设置为 PerWebhook则 Webhook 的此数量 hook_task 记录将被保留(即保留最新的 x 个传递)。
@@ -919,7 +920,7 @@ Gitea 创建以下非唯一队列:
- `ENABLED`: **true**: 启用清理过期包任务。
- `RUN_AT_START`: **true**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 每次运行此任务时都会通知。
- `SCHEDULE`: **@midnight**: Cron语法用于任务。
- `SCHEDULE`: **@midnight**: Cron 语法,用于任务。
- `OLDER_THAN`: **24h**: 未引用的包数据创建超过 OLDER_THAN 时间的包将被删除。
#### Cron - 更新迁移海报 ID (`cron.update_migration_poster_id`)
@@ -937,7 +938,7 @@ Gitea 创建以下非唯一队列:
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
- `TIMEOUT`: **60s**: 用于垃圾收集执行超时的时间持续语法。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `ARGS`: **_empty_**: `git gc` 命令的参数,例如 `--aggressive --auto`。默认值与 [git] -> GC_ARGS 相同。
@@ -947,95 +948,95 @@ Gitea 创建以下非唯一队列:
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
#### Cron - 重新同步所有仓库的 pre-receive、update 和 post-receive 钩子 (`cron.resync_all_hooks`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
#### Cron - 重新初始化所有缺失的 Git 仓库,但记录已存在 (`cron.reinit_missing_repos`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
#### Cron - 删除所有缺少 Git 文件的仓库 (`cron.delete_missing_repos`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
#### Cron - 删除生成的仓库头像 (`cron.delete_generated_repository_avatars`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 72h**: Cron语法用于安排仓库存档清理例如 `@every 1h`
- `SCHEDULE`: **@every 72h**: Cron 语法,用于安排仓库存档清理,例如 `@every 1h`
#### Cron - 从数据库中删除所有旧的操作 (`cron.delete_old_actions`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NOTICE_ON_SUCCESS`: **false**: 设置为 true 以打开成功通知。
- `SCHEDULE`: **@every 168h**: Cron语法用于设置多长时间进行检查。
- `OLDER_THAN`: **8760h**: 早于此表达式的任何操作都将从数据库中删除,建议使用 `8760h`1年因为这是热力图的最大长度。
- `SCHEDULE`: **@every 168h**: Cron 语法,用于设置多长时间进行检查。
- `OLDER_THAN`: **8760h**: 早于此表达式的任何操作都将从数据库中删除,建议使用 `8760h`1 年),因为这是热力图的最大长度。
#### Cron - 从数据库中删除所有旧的系统通知 (`cron.delete_old_system_notices`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `NO_SUCCESS_NOTICE`: **false**: 设置为 true 以关闭成功通知。
- `SCHEDULE`: **@every 168h**: Cron语法用于设置多长时间进行检查。
- `SCHEDULE`: **@every 168h**: Cron 语法,用于设置多长时间进行检查。
- `OLDER_THAN`: **8760h**: 早于此表达式的任何系统通知都将从数据库中删除。
#### Cron - 在仓库中回收 LFS 指针 (`cron.gc_lfs`)
- `ENABLED`: **false**: 启用服务。
- `RUN_AT_START`: **false**: 在启动时运行任务(如果启用)。
- `SCHEDULE`: **@every 24h**: Cron语法用于设置多长时间进行检查。
- `OLDER_THAN`: **168h**: 只会尝试回收早于此时间(默认7天)的 LFSMetaObject。
- `LAST_UPDATED_MORE_THAN_AGO`: **72h**: 只会尝试回收超过此时间(默认3天)没有尝试过回收的 LFSMetaObject。
- `SCHEDULE`: **@every 24h**: Cron 语法,用于设置多长时间进行检查。
- `OLDER_THAN`: **168h**: 只会尝试回收早于此时间(默认 7 天)的 LFSMetaObject。
- `LAST_UPDATED_MORE_THAN_AGO`: **72h**: 只会尝试回收超过此时间(默认 3 天)没有尝试过回收的 LFSMetaObject。
- `NUMBER_TO_CHECK_PER_REPO`: **100**: 每个仓库要检查的过期 LFSMetaObject 的最小数量。设置为 `0` 以始终检查所有。
## Git (`git`)
- `PATH`: **""**: Git可执行文件的路径。如果为空Gitea将在PATH环境中搜索。
- `HOME_PATH`: **`{APP_DATA_PATH}/home`**: GitHOME目录。
此目录将用于包含Giteagit调用将使用的`.gitconfig`和可能的`.gnupg`目录。如果您可以确认Gitea是在此环境中唯一运行的应用程序您可以将其设置为Gitea用户的正常主目录。
- `PATH`: **""**: Git 可执行文件的路径。如果为空Gitea 将在 PATH 环境中搜索。
- `HOME_PATH`: **`{APP_DATA_PATH}/home`**: GitHOME 目录。
此目录将用于包含 Giteagit 调用将使用的`.gitconfig`和可能的`.gnupg`目录。如果您可以确认 Gitea 是在此环境中唯一运行的应用程序,您可以将其设置为 Gitea 用户的正常主目录。
- `DISABLE_DIFF_HIGHLIGHT`: **false**: 禁用已添加和已删除更改的高亮显示。
- `MAX_GIT_DIFF_LINES`: **1000**: 在diff视图中允许单个文件的最大行数。
- `MAX_GIT_DIFF_LINE_CHARACTERS`: **5000**: 在diff视图中每行的最大字符数。
- `MAX_GIT_DIFF_FILES`: **100**: 在diff视图中显示的最大文件数。
- `MAX_GIT_DIFF_LINES`: **1000**: 在 diff 视图中允许单个文件的最大行数。
- `MAX_GIT_DIFF_LINE_CHARACTERS`: **5000**: 在 diff 视图中每行的最大字符数。
- `MAX_GIT_DIFF_FILES`: **100**: 在 diff 视图中显示的最大文件数。
- `COMMITS_RANGE_SIZE`: **50**: 设置默认的提交范围大小
- `BRANCHES_RANGE_SIZE`: **20**: 设置默认的分支范围大小
- `GC_ARGS`: **_empty_**: 命令`git gc`的参数,例如`--aggressive --auto`。更多信息请参见http://git-scm.com/docs/git-gc/
- `ENABLE_AUTO_GIT_WIRE_PROTOCOL`: **true**: 如果使用Git版本 >= 2.18时使用Git wire协议版本2默认为true当您始终希望使用Git wire协议版本1时设置为false。
要在使用OpenSSH服务器的情况下为通过SSHGit启用此功能请将`AcceptEnv GIT_PROTOCOL`添加到您的sshd_config文件中。
- `PULL_REQUEST_PUSH_MESSAGE`: **true**: 对于推送到非默认分支的响应使用URL创建拉取请求如果启用了该存储库的拉取请求
- `ENABLE_AUTO_GIT_WIRE_PROTOCOL`: **true**: 如果使用 Git 版本 >= 2.18 时使用 Git wire 协议版本 2默认为 true当您始终希望使用 Git wire 协议版本 1 时设置为 false。
要在使用 OpenSSH 服务器的情况下为通过 SSHGit 启用此功能,请将`AcceptEnv GIT_PROTOCOL`添加到您的 sshd_config 文件中。
- `PULL_REQUEST_PUSH_MESSAGE`: **true**: 对于推送到非默认分支的响应,使用 URL 创建拉取请求(如果启用了该存储库的拉取请求)
- `VERBOSE_PUSH`: **true**: 在处理推送时打印有关推送状态的信息。
- `VERBOSE_PUSH_DELAY`: **5s**: 仅在推送时间超过此延迟时才打印详细信息。
- `LARGE_OBJECT_THRESHOLD`: **1048576**: 仅限于Go-Git不要在内存中缓存大于此大小的对象。设置为0以禁用。)
- `DISABLE_CORE_PROTECT_NTFS`: **false**`core.protectNTFS`强制设置为false。
- `DISABLE_PARTIAL_CLONE`: **false** 禁用使用部分克隆进行git。
- `LARGE_OBJECT_THRESHOLD`: **1048576**: (仅限于 Go-Git不要在内存中缓存大于此大小的对象。设置为 0 以禁用。)
- `DISABLE_CORE_PROTECT_NTFS`: **false**`core.protectNTFS`强制设置为 false。
- `DISABLE_PARTIAL_CLONE`: **false** 禁用使用部分克隆进行 git。
### Git - 超时设置 (`git.timeout`)
- `DEFAULT`: **360**: Git操作的默认超时时间单位秒
- `DEFAULT`: **360**: Git 操作的默认超时时间,单位秒
- `MIGRATE`: **600**: 在迁移外部存储库时的超时时间,单位秒
- `MIRROR`: **300**: 在镜像外部存储库时的超时时间,单位秒
- `CLONE`: **300**: 在存储库之间进行内部克隆的超时时间,单位秒
- `PULL`: **300**: 在存储库之间进行内部拉取的超时时间,单位秒
- `GC`: **60**: git存储库GC的超时时间单位秒
- `GC`: **60**: git 存储库 GC 的超时时间,单位秒
### Git - 配置选项 (`git.config`)
此部分中的键/值对将用作git配置。
此部分仅执行“设置”配置从此部分中删除的配置键不会自动从git配置中删除。格式为`some.configKey = value`
此部分中的键/值对将用作 git 配置。
此部分仅执行“设置”配置,从此部分中删除的配置键不会自动从 git 配置中删除。格式为`some.configKey = value`
- `diff.algorithm`: **histogram**
- `core.logAllRefUpdates`: **true**
@@ -1043,45 +1044,45 @@ Gitea 创建以下非唯一队列:
## 指标 (`metrics`)
- `ENABLED`: **false**: 启用/prometheusmetrics端点。
- `ENABLED`: **false**: 启用/prometheusmetrics 端点。
- `ENABLED_ISSUE_BY_LABEL`: **false**: 启用按标签统计问题,格式为`gitea_issues_by_label{label="bug"} 2`
- `ENABLED_ISSUE_BY_REPOSITORY`: **false**: 启用按存储库统计问题,格式为`gitea_issues_by_repository{repository="org/repo"} 5`
- `TOKEN`: **_empty_**: 如果要在授权中包含指标则需要指定令牌。相同的令牌需要在prometheus参数`bearer_token``bearer_token_file`中使用。
- `TOKEN`: **_empty_**: 如果要在授权中包含指标,则需要指定令牌。相同的令牌需要在 prometheus 参数`bearer_token``bearer_token_file`中使用。
## API (`api`)
- `ENABLE_SWAGGER`: **true**: 启用API文档接口 (`/api/swagger`, `/api/v1/swagger`, …). True or false。
- `MAX_RESPONSE_ITEMS`: **50**: API分页的最大单页项目数。
- `DEFAULT_PAGING_NUM`: **30**: API分页的默认分页数。
- `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: Git trees API的默认单页项目数。
- `DEFAULT_MAX_BLOB_SIZE`: **10485760** (10MiB): blobs API的默认最大文件大小。
- `ENABLE_SWAGGER`: **true**: 启用 API 文档接口 (`/api/swagger`, `/api/v1/swagger`, …). True or false。
- `MAX_RESPONSE_ITEMS`: **50**: API 分页的最大单页项目数。
- `DEFAULT_PAGING_NUM`: **30**: API 分页的默认分页数。
- `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: Git trees API 的默认单页项目数。
- `DEFAULT_MAX_BLOB_SIZE`: **10485760** (10MiB): blobs API 的默认最大文件大小。
## OAuth2 (`oauth2`)
- `ENABLED`: **true**: 启用OAuth2提供者。
- `ACCESS_TOKEN_EXPIRATION_TIME`**3600**: OAuth2访问令牌的生命周期以秒为单位。
- `REFRESH_TOKEN_EXPIRATION_TIME`**730**: OAuth2刷新令牌的生命周期以小时为单位。
- `ENABLED`: **true**: 启用 OAuth2 提供者。
- `ACCESS_TOKEN_EXPIRATION_TIME`**3600**: OAuth2 访问令牌的生命周期,以秒为单位。
- `REFRESH_TOKEN_EXPIRATION_TIME`**730**: OAuth2 刷新令牌的生命周期,以小时为单位。
- `INVALIDATE_REFRESH_TOKENS`**false**: 检查刷新令牌是否已被使用。
- `JWT_SIGNING_ALGORITHM`**RS256**: 用于签署OAuth2令牌的算法。有效值[`HS256``HS384``HS512``RS256``RS384``RS512``ES256``ES384``ES512`]。
- `JWT_SECRET`**_empty_**: OAuth2访问和刷新令牌的身份验证密钥请将其更改为唯一的字符串。仅当`JWT_SIGNING_ALGORITHM`设置为`HS256``HS384``HS512`时才需要此设置。
- `JWT_SECRET_URI`**_empty_**: 可以使用此配置选项,而不是在配置中定义`JWT_SECRET`以向Gitea提供包含密钥的文件的路径示例值`file:/etc/gitea/oauth2_jwt_secret`)。
- `JWT_SIGNING_PRIVATE_KEY_FILE`**jwt/private.pem**: 用于签署OAuth2令牌的私钥文件路径。路径相对于`APP_DATA_PATH`。仅当`JWT_SIGNING_ALGORITHM`设置为`RS256``RS384``RS512``ES256``ES384``ES512`时才需要此设置。文件必须包含PKCS8格式的RSAECDSA私钥。如果不存在密钥则将为您创建一个4096位密钥。
- `MAX_TOKEN_LENGTH`**32767**: 从OAuth2提供者接受的令牌/cookie的最大长度。
- `DEFAULT_APPLICATIONS`**git-credential-oauthgit-credential-manager, tea**: 在启动时预注册用于某些服务的OAuth应用程序。有关可用选项列表请参阅[OAuth2文档](/development/oauth2-provider.md)。
- `JWT_SIGNING_ALGORITHM`**RS256**: 用于签署 OAuth2 令牌的算法。有效值:[`HS256``HS384``HS512``RS256``RS384``RS512``ES256``ES384``ES512`]。
- `JWT_SECRET`**_empty_**: OAuth2 访问和刷新令牌的身份验证密钥,请将其更改为唯一的字符串。仅当`JWT_SIGNING_ALGORITHM`设置为`HS256``HS384``HS512`时才需要此设置。
- `JWT_SECRET_URI`**_empty_**: 可以使用此配置选项,而不是在配置中定义`JWT_SECRET`,以向 Gitea 提供包含密钥的文件的路径(示例值:`file:/etc/gitea/oauth2_jwt_secret`)。
- `JWT_SIGNING_PRIVATE_KEY_FILE`**jwt/private.pem**: 用于签署 OAuth2 令牌的私钥文件路径。路径相对于`APP_DATA_PATH`。仅当`JWT_SIGNING_ALGORITHM`设置为`RS256``RS384``RS512``ES256``ES384``ES512`时才需要此设置。文件必须包含 PKCS8 格式的 RSAECDSA 私钥。如果不存在密钥,则将为您创建一个 4096 位密钥。
- `MAX_TOKEN_LENGTH`**32767**: 从 OAuth2 提供者接受的令牌/cookie 的最大长度。
- `DEFAULT_APPLICATIONS`**git-credential-oauthgit-credential-manager, tea**: 在启动时预注册用于某些服务的 OAuth 应用程序。有关可用选项列表,请参阅[OAuth2 文档](/development/oauth2-provider.md)。
## i18n (`i18n`)
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
在语言选择器中显示的区域设置列表。如果用户浏览器的语言与列表中的任何区域设置不匹配,则将使用第一个区域设置作为默认值。
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
在语言选择器中显示的区域设置列表。如果用户浏览器的语言与列表中的任何区域设置不匹配,则将使用第一个区域设置作为默认值。
- `NAMES`**English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,Français,Nederlands,Latviešu,Русский,Українська,日本語,Español,Português do Brasil,Português de Portugal,Polski,Български,Italiano,Suomi,Türkçe,Čeština,Српски,Svenska,한국어,Ελληνικά,فارسی,Magyar nyelv,Bahasa Indonesia,മലയാളം**:
对应于各区域设置的可见名称。
- `NAMES`**English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,Français,Nederlands,Latviešu,Русский,Українська,日本語,Español,Português do Brasil,Português de Portugal,Polski,Български,Italiano,Suomi,Türkçe,Čeština,Српски,Svenska,한국어,Ελληνικά,فارسی,Magyar nyelv,Bahasa Indonesia,മലയാളം**:
对应于各区域设置的可见名称。
## Markup (`markup`)
- `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: 设置Mermaid源的最大大小。(设为-1代表禁止)
- `MERMAID_MAX_SOURCE_CHARACTERS`: **5000**: 设置 Mermaid 源的最大大小。(设为-1 代表禁止)
gitea支持外部渲染工具你可以配置你熟悉的文档渲染工具. 比如一下将新增一个名字为 asciidoc 的渲染工具。
gitea 支持外部渲染工具,你可以配置你熟悉的文档渲染工具. 比如一下将新增一个名字为 asciidoc 的渲染工具。
```ini
[markup.asciidoc]
@@ -1093,21 +1094,21 @@ IS_INPUT_FILE = false
```
- ENABLED**false** 设置是否启动渲染器
- NEED_POSTPROCESS**true** 设置为**true**以替换链接/SHA1等。
- FILE_EXTENSIONS**_empty_** 要由外部命令渲染的文件扩展名列表。多个扩展名需要用逗号分隔。
- NEED_POSTPROCESS**true** 设置为**true**以替换链接/SHA1 等。
- FILE*EXTENSIONS\*\*\_empty*\*\* 要由外部命令渲染的文件扩展名列表。多个扩展名需要用逗号分隔。
- RENDER_COMMAND用于渲染所有匹配的扩展名的外部命令。
- IS_INPUT_FILE**false** 输入不是标准输入,而是一个在`RENDER_COMMAND`之后带有文件参数的文件。
- RENDER_CONTENT_MODE**sanitized** 内容将如何呈现。
- sanitized对内容进行清理并在当前页面内呈现默认仅允许一些HTML标签和属性。可以在`[markup.sanitizer.*]`中定义自定义的清理规则。
- no-sanitizer禁用清理程序在当前页面内呈现内容。这是**不安全**的如果内容包含恶意代码可能会导致XSS攻击。
- iframe在单独的独立页面中呈现内容并通过iframe嵌入到当前页面中。iframe处于禁用同源策略的沙箱模式并且JS代码与父页面安全隔离。
- sanitized对内容进行清理并在当前页面内呈现默认仅允许一些 HTML 标签和属性。可以在`[markup.sanitizer.*]`中定义自定义的清理规则。
- no-sanitizer禁用清理程序在当前页面内呈现内容。这是**不安全**的,如果内容包含恶意代码,可能会导致 XSS 攻击。
- iframe在单独的独立页面中呈现内容并通过 iframe 嵌入到当前页面中。iframe 处于禁用同源策略的沙箱模式,并且 JS 代码与父页面安全隔离。
两个特殊的环境变量会传递给渲染命令:
- `GITEA_PREFIX_SRC`,其中包含`src`路径树中的当前URL前缀。用作链接的前缀。
- `GITEA_PREFIX_RAW`,其中包含`raw`路径树中的当前URL前缀。用作图像路径的前缀。
- `GITEA_PREFIX_SRC`,其中包含`src`路径树中的当前 URL 前缀。用作链接的前缀。
- `GITEA_PREFIX_RAW`,其中包含`raw`路径树中的当前 URL 前缀。用作图像路径的前缀。
如果`RENDER_CONTENT_MODE``sanitized`Gitea支持自定义用于呈现的HTML的清理策略。下面的示例将支持来自pandocKaTeX输出。
如果`RENDER_CONTENT_MODE``sanitized`Gitea 支持自定义用于呈现的 HTML 的清理策略。下面的示例将支持来自 pandocKaTeX 输出。
```ini
[markup.sanitizer.TeX]
@@ -1122,18 +1123,18 @@ ALLOW_DATA_URI_IMAGES = true
- `ELEMENT`:此策略适用于的元素。必须非空。
- `ALLOW_ATTR`:此策略允许的属性。必须非空。
- `REGEXP`:用于匹配属性内容的正则表达式。必须存在,但可以为空,以无条件允许此属性的白名单。
- `ALLOW_DATA_URI_IMAGES`**false** 允许数据URI图像`<img src="data:image/png;base64,..."/>`)。
- `ALLOW_DATA_URI_IMAGES`**false** 允许数据 URI 图像(`<img src="data:image/png;base64,..."/>`)。
可以通过添加唯一的子节来定义多个清理规则,例如`[markup.sanitizer.TeX-2]`
要仅为指定的外部渲染器应用清理规则,它们必须使用渲染器名称,例如`[markup.sanitizer.asciidoc.rule-1]`
如果规则在渲染器ini节之上定义或者名称与渲染器不匹配则应用于每个渲染器。
如果规则在渲染器 ini 节之上定义,或者名称与渲染器不匹配,则应用于每个渲染器。
## 代码高亮映射 (`highlight.mapping`)
- `file_extension 比如 .toml`: **language 比如 ini**。文件扩展名到语言的映射覆盖。
- Gitea 将使用 `.gitattributes` 文件中的 `linguist-language``gitlab-language` 属性来对文件进行高亮显示,如果可用。
如果未设置此属性或语言不可用,则将查找文件扩展名在此映射中或使用启发式方法来确定文件类型。
如果未设置此属性或语言不可用,则将查找文件扩展名在此映射中或使用启发式方法来确定文件类型。
## 时间 (`time`)
@@ -1213,11 +1214,11 @@ ALLOW_DATA_URI_IMAGES = true
- `MINIO_BASE_PATH`**lfs/**: 桶上的 Minio 基本路径,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_USE_SSL`**false**: Minio 启用 ssl仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`**false**: Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket 查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
## 存储 (`storage`)
默认的附件、lfs、头像、仓库头像、仓库归档、软件包、操作日志、artifacts 的存储配置。推荐仅仅配置此 section 并让其它的section 从此配置项继承。
默认的附件、lfs、头像、仓库头像、仓库归档、软件包、操作日志、artifacts 的存储配置。推荐仅仅配置此 section 并让其它的 section 从此配置项继承。
- `STORAGE_TYPE`**local**: 存储类型,`local` 表示本地磁盘,`minio` 表示 S3`azureblob` 表示 azure 对象存储。
- `SERVE_DIRECT`**false**: 允许存储驱动程序重定向到经过身份验证的 URL 以直接提供文件。目前,仅支持通过签名的 URL 提供 Minio/S3本地不执行任何操作。
@@ -1228,7 +1229,7 @@ ALLOW_DATA_URI_IMAGES = true
- `MINIO_LOCATION`**us-east-1**: 创建桶的 Minio 位置,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_USE_SSL`**false**: Minio 启用 ssl仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_INSECURE_SKIP_VERIFY`**false**: Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket 查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `AZURE_BLOB_ENDPOINT`: **_empty_**: Azure Blob 终端点,仅在 `STORAGE_TYPE``azureblob` 时可用。例如https://accountname.blob.core.windows.net 或 http://127.0.0.1:10000/devstoreaccount1
- `AZURE_BLOB_ACCOUNT_NAME`: **_empty_**: Azure Blob 账号名,仅在 `STORAGE_TYPE``azureblob` 时可用。
@@ -1311,29 +1312,29 @@ MINIO_BUCKET_LOOKUP_TYPE = auto
存储库归档存储的配置。当将`STORAGE_TYPE`设置为`xxx`时,它将继承默认的 `[storage]``[storage.xxx]` 配置。`PATH`的默认值是`data/repo-archive``MINIO_BASE_PATH`的默认值是`repo-archive/`
- `STORAGE_TYPE`: **local**: 存储类型,`local`表示本地磁盘,`minio`表示与S3兼容的对象存储服务或者使用定义为`[storage.xxx]`的其他名称。
- `SERVE_DIRECT`: **false**: 允许存储驱动程序重定向到经过身份验证的URL以直接提供文件。目前只有Minio/S3支持通过签名URL本地不执行任何操作。
- `STORAGE_TYPE`: **local**: 存储类型,`local`表示本地磁盘,`minio`表示与 S3 兼容的对象存储服务,或者使用定义为`[storage.xxx]`的其他名称。
- `SERVE_DIRECT`: **false**: 允许存储驱动程序重定向到经过身份验证的 URL 以直接提供文件。目前,只有 Minio/S3 支持通过签名 URL本地不执行任何操作。
- `PATH`: **./data/repo-archive**: 用于存储归档文件的位置,仅在`STORAGE_TYPE``local`时可用。
- `MINIO_ENDPOINT`: **localhost:9000**: Minio端点仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_ACCESS_KEY_ID`: MinioaccessKeyID仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_SECRET_ACCESS_KEY`: MiniosecretAccessKey仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET`: **gitea**: 用于存储归档的Minio存储桶仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_LOCATION`: **us-east-1**: 用于创建存储桶的Minio位置仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BASE_PATH`: **repo-archive/**: 存储桶上的Minio基本路径仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_USE_SSL`: **false**: 启用MinioSSL仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: 跳过MinioSSL验证仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
- `MINIO_ENDPOINT`: **localhost:9000**: Minio 端点,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_ACCESS_KEY_ID`: MinioaccessKeyID仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_SECRET_ACCESS_KEY`: MiniosecretAccessKey仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET`: **gitea**: 用于存储归档的 Minio 存储桶,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_LOCATION`: **us-east-1**: 用于创建存储桶的 Minio 位置,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BASE_PATH`: **repo-archive/**: 存储桶上的 Minio 基本路径,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_USE_SSL`: **false**: 启用 MinioSSL仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: 跳过 MinioSSL 验证,仅在`STORAGE_TYPE``minio`时可用。
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Miniobucket 查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
### 存储库归档 (`repo-archive`)
- `STORAGE_TYPE`: **local**: 存储类型,用于操作日志,`local`表示本地磁盘,`minio`表示与S3兼容的对象存储服务默认为`local`,或者使用定义为`[storage.xxx]`的其他名称。
- `MINIO_BASE_PATH`: **repo-archive/**: Minio存储桶上的基本路径仅在`STORAGE_TYPE``minio`时可用。
- `STORAGE_TYPE`: **local**: 存储类型,用于操作日志,`local`表示本地磁盘,`minio`表示与 S3 兼容的对象存储服务,默认为`local`,或者使用定义为`[storage.xxx]`的其他名称。
- `MINIO_BASE_PATH`: **repo-archive/**: Minio 存储桶上的基本路径,仅在`STORAGE_TYPE``minio`时可用。
## 代理 (`proxy`)
- `PROXY_ENABLED`: **false**: 启用代理如果为true所有通过HTTP向外部的请求都将受到影响如果为false即使环境设置了http_proxy/https_proxy也不会使用
- `PROXY_ENABLED`: **false**: 启用代理,如果为 true所有通过 HTTP 向外部的请求都将受到影响,如果为 false即使环境设置了 http_proxy/https_proxy 也不会使用
- `PROXY_URL`: **_empty_**: 代理服务器地址,支持 http://, https//, socks://,为空则不启用代理而使用环境变量中的 http_proxy/https_proxy
- `PROXY_HOSTS`: **_empty_**: 逗号分隔的多个需要代理的网址,支持 * 号匹配符号, ** 表示匹配所有网站
- `PROXY_HOSTS`: **_empty_**: 逗号分隔的多个需要代理的网址,支持 \* 号匹配符号, \*\* 表示匹配所有网站
i.e.
@@ -1347,8 +1348,8 @@ PROXY_HOSTS = *.github.com
- `ENABLED`: **true**: 启用/禁用操作功能
- `DEFAULT_ACTIONS_URL`: **github**: 获取操作插件的默认平台,`github`表示`https://github.com``self`表示当前的 Gitea 实例。
- `STORAGE_TYPE`: **local**: 用于操作日志的存储类型,`local`表示本地磁盘,`minio`表示与S3兼容的对象存储服务默认为`local`,或者使用定义为`[storage.xxx]`的其他名称。
- `MINIO_BASE_PATH`: **actions_log/**: Minio存储桶上的基本路径仅在`STORAGE_TYPE``minio`时可用。
- `STORAGE_TYPE`: **local**: 用于操作日志的存储类型,`local`表示本地磁盘,`minio`表示与 S3 兼容的对象存储服务,默认为`local`,或者使用定义为`[storage.xxx]`的其他名称。
- `MINIO_BASE_PATH`: **actions_log/**: Minio 存储桶上的基本路径,仅在`STORAGE_TYPE``minio`时可用。
- `LOG_RETENTION_DAYS`: **365**: 日志保留时间(天)。此期限后将删除旧日志。
- `LOG_COMPRESSION`: **zstd**: 日志压缩方式,`none`表示不压缩,`zstd`表示 zstd 压缩。
其它的压缩方式如`gzip`是不支持的,因为查看日志需要可寻址流。
@@ -1376,8 +1377,8 @@ PROXY_HOSTS = *.github.com
## 其他 (`other`)
- `SHOW_FOOTER_VERSION`: **true**: 在页面底部显示Gitea的版本。
- `SHOW_FOOTER_VERSION`: **true**: 在页面底部显示 Gitea 的版本。
- `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: 在页脚显示模板执行的时间。
- `SHOW_FOOTER_POWERED_BY`: **true**: 在页脚显示“由...提供动力”的文本。
- `ENABLE_SITEMAP`: **true**: 生成sitemap.
- `ENABLE_FEED`: **true**: 是否启用RSS/Atom
- `ENABLE_SITEMAP`: **true**: 生成 sitemap.
- `ENABLE_FEED`: **true**: 是否启用 RSS/Atom

View File

@@ -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 结束处的模板

View File

@@ -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

View File

@@ -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 的形式运行。

View File

@@ -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;

View File

@@ -5,7 +5,6 @@ sidebar_position: 16
aliases:
- /zh-cn/fail2ban-setup
---
# 设置 Fail2ban

View File

@@ -5,7 +5,6 @@ sidebar_position: 12
aliases:
- /zh-cn/git-lfs-setup
---
# Git LFS 设置

View File

@@ -17,18 +17,18 @@ aliases:
目前,以下通知事件使用模板:
| 操作名称 | 用途 |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| `new` | 创建了新的工单或合并请求。 |
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
| `close` | 关闭了工单或合并请求。 |
| `reopen` | 重新打开了工单或合并请求。 |
| `review` | 在合并请求中进行审查的首要评论。 |
| `approve` | 对合并请求进行批准的首要评论。 |
| `reject` | 对合并请求提出更改请求的审查的首要评论。 |
| `code` | 关于合并请求的代码的单个评论。 |
| `assigned` | 用户被分配到工单或合并请求。 |
| `default` | 未包括在上述类别中的任何操作,或者当对应类别的模板不存在时使用的模板。 |
| 操作名称 | 用途 |
| ---------- | ---------------------------------------------------------------------- |
| `new` | 创建了新的工单或合并请求。 |
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
| `close` | 关闭了工单或合并请求。 |
| `reopen` | 重新打开了工单或合并请求。 |
| `review` | 在合并请求中进行审查的首要评论。 |
| `approve` | 对合并请求进行批准的首要评论。 |
| `reject` | 对合并请求提出更改请求的审查的首要评论。 |
| `code` | 关于合并请求的代码的单个评论。 |
| `assigned` | 用户被分配到工单或合并请求。 |
| `default` | 未包括在上述类别中的任何操作,或者当对应类别的模板不存在时使用的模板。 |
特定消息类型的模板路径为:
@@ -72,25 +72,25 @@ 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 并进行了清理。请勿与 _邮件正文_ 混淆。 |
| `.Link` | string | 始终可用 | 源工单、合并请求或评论的地址。 |
| `.Issue` | models.Issue | 始终可用 | 产生通知的工单(或合并请求)。要获取特定于合并请求的数据(例如 `HasMerged`),可以使用 `.Issue.PullRequest`,但需要注意,如果工单 _不是_ 合并请求,则该字段将为 `nil` |
| `.Comment` | models.Comment | 如果适用 | 如果通知是针对添加到工单或合并请求的评论,则其中包含有关评论的信息。 |
| `.IsPull` | bool | 始终可用 | 如果邮件通知与合并请求关联(即 `.Issue.PullRequest` 不为 `nil` ),则为 `true` |
| `.Repo` | string | 始终可用 | 仓库的名称,包括所有者名称(例如 `mike/stuff` |
| `.User` | models.User | 始终可用 | 事件来源仓库的所有者。要获取用户名(例如 `mike`),可以使用 `.User.Name` |
| `.Doer` | models.User | 始终可用 | 执行触发通知事件的操作的用户。要获取用户名(例如 `rhonda`),可以使用 `.Doer.Name` |
| `.IsMention` | bool | 始终可用 | 如果此通知仅是因为在评论中提到了用户而生成的,并且收件人未订阅源,则为 `true`。如果收件人已订阅工单或仓库,则为 `false` |
| `.SubjectPrefix` | string | 始终可用 | 如果通知是关于除工单或合并请求创建之外的其他内容,则为 `Re`;否则为空字符串。 |
| `.ActionType` | string | 始终可用 | `"issue"``"pull"`。它将与实际的 _操作类型_ 对应,与选择的模板无关。 |
| `.ActionName` | string | 始终可用 | 它将是上述操作类型之一(`new` `comment` 等),并与选择的模板对应。 |
| `.ReviewComments` | []models.Comment | 始终可用 | 审查中的代码评论列表。评论文本将在 `.RenderedContent` 中,引用的代码将在 `.Patch` 中。 |
| 名称 | 类型 | 可用性 | 用途 |
| ------------------ | ---------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_。 |
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
| `.Link` | string | 始终可用 | 源工单、合并请求或评论的地址。 |
| `.Issue` | models.Issue | 始终可用 | 产生通知的工单(或合并请求)。要获取特定于合并请求的数据(例如 `HasMerged`),可以使用 `.Issue.PullRequest`,但需要注意,如果工单 _不是_ 合并请求,则该字段将为 `nil`。 |
| `.Comment` | models.Comment | 如果适用 | 如果通知是针对添加到工单或合并请求的评论,则其中包含有关评论的信息。 |
| `.IsPull` | bool | 始终可用 | 如果邮件通知与合并请求关联(即 `.Issue.PullRequest` 不为 `nil` ),则为 `true`。 |
| `.Repo` | string | 始终可用 | 仓库的名称,包括所有者名称(例如 `mike/stuff` |
| `.User` | models.User | 始终可用 | 事件来源仓库的所有者。要获取用户名(例如 `mike`),可以使用 `.User.Name`。 |
| `.Doer` | models.User | 始终可用 | 执行触发通知事件的操作的用户。要获取用户名(例如 `rhonda`),可以使用 `.Doer.Name`。 |
| `.IsMention` | bool | 始终可用 | 如果此通知仅是因为在评论中提到了用户而生成的,并且收件人未订阅源,则为 `true`。如果收件人已订阅工单或仓库,则为 `false`。 |
| `.SubjectPrefix` | string | 始终可用 | 如果通知是关于除工单或合并请求创建之外的其他内容,则为 `Re`;否则为空字符串。 |
| `.ActionType` | string | 始终可用 | `"issue"``"pull"`。它将与实际的 _操作类型_ 对应,与选择的模板无关。 |
| `.ActionName` | string | 始终可用 | 它将是上述操作类型之一(`new` `comment` 等),并与选择的模板对应。 |
| `.ReviewComments` | []models.Comment | 始终可用 | 审查中的代码评论列表。评论文本将在 `.RenderedContent` 中,引用的代码将在 `.Patch` 中。 |
所有名称区分大小写。
@@ -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 上查看](#)。
@@ -233,20 +233,22 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
模板系统包含一些函数,可用于进一步处理和格式化消息。以下是其中一些函数的列表:
| 函数名 | 参数 | 可用于 | 用法 |
|------------------| ----------- | ------------ | ------------------------------ |
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
| `EllipsisString` | string, int | 任何地方 | 将字符串截断为指定长度;根据需要添加省略号 |
| `SanitizeHTML` | string | 仅正文部分 | 通过删除其中的危险 HTML 标签对文本进行清理 |
| `SafeHTML` | string | 仅正文部分 | 将输入作为 HTML 处理;可用于输出原始的 HTML 内容 |
| 函数名 | 参数 | 可用于 | 用法 |
| ---------------- | ----------- | ---------- | ------------------------------------------------ |
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
| `EllipsisString` | string, int | 任何地方 | 将字符串截断为指定长度;根据需要添加省略号 |
| `SanitizeHTML` | string | 仅正文部分 | 通过删除其中的危险 HTML 标签对文本进行清理 |
| `SafeHTML` | string | 仅正文部分 | 将输入作为 HTML 处理;可用于输出原始的 HTML 内容 |
这些都是 _函数_,而不是元数据,因此必须按以下方式使用:
```html
像这样使用: {{SanitizeHTML "Escape<my>text"}}
或者这样使用: {{"Escape<my>text" | SanitizeHTML}}
或者这样使用: {{AppUrl}}
但不要像这样使用: {{.AppUrl}}
像这样使用: {{SanitizeHTML "Escape<my
>text"}} 或者这样使用: {{"Escape<my
>text" | SanitizeHTML}} 或者这样使用: {{AppUrl}} 但不要像这样使用:
{{.AppUrl}}</my
></my
>
```

View File

@@ -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 等)污染,从而使搜索结果更相关。这还有助于减小索引的大小。

View File

@@ -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`

View File

@@ -22,7 +22,7 @@ User-agent: *
Disallow: /
```
如果您将Gitea安装在子目录中则需要在顶级目录中创建或编辑 `robots.txt`
如果您将 Gitea 安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`
```txt
User-agent: *

View File

@@ -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`

View File

@@ -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`将被GitOpenSSH调用。其他子命令可以帮助维护Gitea。
- `build`:帮助构建 Gitea 的脚本。
- `cmd`:包含所有 Gitea 的实际子命令,包括 web、doctor、serv、hooks、admin 等。`web`将启动 Web 服务。`serv``hooks`将被 GitOpenSSH 调用。其他子命令可以帮助维护 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、modulesservices不能依赖于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、modulesservices不能依赖于 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) ``
### 未来的任务

View File

@@ -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-UIjQuery
* htmx (部分页面重新加载其他静态组件)
* Vanilla JS
- Vue + Vanilla JS
- Fomantic-UIjQuery
- htmx (部分页面重新加载其他静态组件)
- Vanilla JS
不推荐的实现方式:
* Vue + Fomantic-UIjQuery
* jQuery + Vanilla JS
* htmx + 任何其他需要大量 JavaScript 代码或不必要的功能,如 htmx 脚本 (`hx-on`)
- Vue + Fomantic-UIjQuery
- 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 示例的页面。

View File

@@ -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 天后由一名核心成员(非作者)批准后合并。
- 如果最终结果良好,容忍一些不完美/临时的步骤。
- 如果重构是必要的,容忍一些回归错误,并尽快修复错误。

View File

@@ -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 项目。

View File

@@ -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 中附带提交适当的单元测试和集成测试。
## 网站文档

View File

@@ -8,7 +8,7 @@ aliases:
# 集成
Gitea拥有一个出色的第三方集成社区以及在其他各种项目中的一流支持。
Gitea 拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
我们正在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)上整理一个列表来跟踪这些集成!

View File

@@ -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)中找到这些接口。

View File

@@ -33,40 +33,40 @@ Gitea 支持作为 OAuth2 提供者,允许第三方应用程序在用户同意
Gitea 支持以下令牌范围:
| 名称 | 介绍 |
| ---- | ----------- |
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
| **repo** | 完全控制所有存储库 |
| &nbsp;&nbsp;&nbsp; **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **public_repo** | 仅授予对公共存储库的读/写访问权限 |
| **admin:repo_hook** | 授予对所有存储库的 Hooks 访问权限,该权限已包含在 `repo` 范围中 |
| &nbsp;&nbsp;&nbsp; **write:repo_hook** | 授予对存储库 Hooks 的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:repo_hook** | 授予对存储库 Hooks 的只读访问权限 |
| **admin:org** | 授予对组织设置的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:org** | 授予对组织设置的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:org** | 授予对组织设置的只读访问权限 |
| **admin:public_key** | 授予公钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:public_key** | 授予对公钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:public_key** | 授予对公钥的只读访问权限 |
| **admin:org_hook** | 授予对组织级别 Hooks 的完全访问权限 |
| **admin:user_hook** | 授予对用户级别 Hooks 的完全访问权限 |
| **notification** | 授予对通知的完全访问权限 |
| **user** | 授予对用户个人资料信息的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **read:user** | 授予对用户个人资料的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:email** | 授予对用户电子邮件地址的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:follow** | 授予访问权限以关注/取消关注用户 |
| **delete_repo** | 授予删除存储库的权限 |
| **package** | 授予对托管包的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:package** | 授予对包的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:package** | 授予对包的读取权限 |
| &nbsp;&nbsp;&nbsp; **delete:package** | 授予对包的删除权限 |
| **admin:gpg_key** | 授予 GPG 密钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:gpg_key** | 授予对 GPG 密钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:gpg_key** | 授予对 GPG 密钥的只读访问权限 |
| **admin:application** | 授予应用程序管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:application** | 授予应用程序管理的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:application** | 授予应用程序管理的读取权限 |
| **sudo** | 允许以站点管理员身份执行操作 |
| 名称 | 介绍 |
| ---------------------------------------- | --------------------------------------------------------------- |
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
| **repo** | 完全控制所有存储库 |
| &nbsp;&nbsp;&nbsp; **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **public_repo** | 仅授予对公共存储库的读/写访问权限 |
| **admin:repo_hook** | 授予对所有存储库的 Hooks 访问权限,该权限已包含在 `repo` 范围中 |
| &nbsp;&nbsp;&nbsp; **write:repo_hook** | 授予对存储库 Hooks 的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:repo_hook** | 授予对存储库 Hooks 的只读访问权限 |
| **admin:org** | 授予对组织设置的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:org** | 授予对组织设置的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:org** | 授予对组织设置的只读访问权限 |
| **admin:public_key** | 授予公钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:public_key** | 授予对公钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:public_key** | 授予对公钥的只读访问权限 |
| **admin:org_hook** | 授予对组织级别 Hooks 的完全访问权限 |
| **admin:user_hook** | 授予对用户级别 Hooks 的完全访问权限 |
| **notification** | 授予对通知的完全访问权限 |
| **user** | 授予对用户个人资料信息的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **read:user** | 授予对用户个人资料的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:email** | 授予对用户电子邮件地址的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:follow** | 授予访问权限以关注/取消关注用户 |
| **delete_repo** | 授予删除存储库的权限 |
| **package** | 授予对托管包的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:package** | 授予对包的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:package** | 授予对包的读取权限 |
| &nbsp;&nbsp;&nbsp; **delete:package** | 授予对包的删除权限 |
| **admin:gpg_key** | 授予 GPG 密钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:gpg_key** | 授予对 GPG 密钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:gpg_key** | 授予对 GPG 密钥的只读访问权限 |
| **admin:application** | 授予应用程序管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:application** | 授予应用程序管理的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:application** | 授予应用程序管理的读取权限 |
| **sudo** | 允许以站点管理员身份执行操作 |
## 客户端类型

View File

@@ -12,127 +12,127 @@ aliases:
有关更多帮助资源,请查看所有[支持选项](help/support.md)。
## 1.x1.x.x下载之间的区别
## 1.x1.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.51.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.51.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.inidatabase部分的PATH
- SQLite 数据库
- app.inidatabase 部分的 PATH
- 或者`%(APP_DATA_PATH)/gitea.db`
## 看不到克隆URL或克隆URL不正确
## 看不到克隆 URL 或克隆 URL 不正确
有几个地方可能会导致显示不正确。
1. 如果使用反向代理,请确保按照[反向代理指南](../administration/reverse-proxies.md)中的正确说明进行设置。
2. 确保在`app.ini``server`部分中正确设置了`ROOT_URL`
如果某些克隆选项未显示HTTP/SSSH可以在`app.ini中`
如果某些克隆选项未显示HTTP/SSSH可以在`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`
1. 要找到`CustomPath`,请在站点管理 -> 配置 中查找自定义文件根路径。
如果找不到,请尝试`echo $GITEA_CUSTOM`
如果找不到,请尝试`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.iniapi部分将ENABLE_SWAGGER设置为false以禁用其文档显示。
有关更多信息请参阅Gitea的[API文档](development/api-usage.md)。
所有 Gitea 实例都有内置的 API无法完全禁用它。
但是,您可以在 app.iniapi 部分将 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、updatepost-receive钩子”
2. Git仓库和钩子存储在一些不支持脚本执行的文件系统上例如由NAS挂载请确保文件系统支持`chmod a+x any-script`
3. 如果您使用的是Docker请确保Docker Server而不是客户端的版本 >= 20.10.6
1. Git 钩子不同步:在站点管理面板上运行“重新同步所有仓库的 pre-receive、updatepost-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 git@myremote.example`
@@ -247,16 +247,18 @@ fatal: Could not read from remote repository.
- 在客户端:
- 确保公钥和私钥已添加到正确的 Gitea 用户。
- 确保远程 URL 中没有任何问题。特别是,请确保∂
Git 用户(@ 之前的部分)的名称拼写正确。
- 确保远程 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 规范,看看问题是由错误还是非兼容的语法引起的。
如果是后者,通常规范中会列出一种符合标准的替代方法。

View File

@@ -58,12 +58,12 @@ Gitea 可以使用 Golang 的 pprof 处理程序和工具链来收集堆栈跟
1. 设置 app.ini
```
[server]
ENABLE_PPROF = true
```
```
[server]
ENABLE_PPROF = true
```
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`

View File

@@ -14,68 +14,68 @@ aliases:
_表格中的符号含义:_
* _✓ - 支持_
- _✓ - 支持_
* _ - 部分支持_
- _ - 部分支持_
* _✘ - 不支持_
- _✘ - 不支持_
* _⚙ - 由第三方服务或插件支持_
- _⚙ - 由第三方服务或插件支持_
#### 主要特性
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| ------------------------------- | -------------------------------------------------- | ---- | --------- | --------- | --------- | -------------- | ------------ |
| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ |
| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ |
| 支持多种数据库 | ✓ | ✓ | ✘ | | | ✓ | ✓ |
| 支持多种操作系统 | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ |
| 升级简便 | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 可观测性 | **✘** | ✘ | ✓ | ✓ | ✓ | ✓ | ? |
| 支持第三方渲染工具 | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? |
| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? |
| 扩展 API | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 内置软件包/容器注册中心 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 同步提交到外部仓库 (push mirror) | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 同步外部仓库的提交 (pull mirror) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ? |
| 浅色和深色主题 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ? |
| 自定义主题支持 | ✓ | ✓ | ✘ | ✘ | ✘ | ✓ | ✘ |
| 支持 Markdown | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 支持 CSV | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? |
| Git 驱动的静态 pages | [⚙️][gitea-pages-server], [⚙️][gitea-caddy-plugin] | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Git 驱动的集成化 wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ |
| 部署令牌 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 仓库写权限令牌 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| RSS Feeds | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ✘ |
| 内置 CI/CD | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 子组织:组织内的组织 | [](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 多实例交互 | [/](https://github.com/go-gitea/gitea/issues/18240) | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
| Markdown绘图 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Markdown数学公式 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| -------------------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | -------------- | ------------ |
| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ |
| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ |
| 支持多种数据库 | ✓ | ✓ | ✘ | | | ✓ | ✓ |
| 支持多种操作系统 | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ |
| 升级简便 | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 可观测性 | **✘** | ✘ | ✓ | ✓ | ✓ | ✓ | ? |
| 支持第三方渲染工具 | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? |
| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? |
| 扩展 API | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 内置软件包/容器注册中心 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 同步提交到外部仓库 (push mirror) | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 同步外部仓库的提交 (pull mirror) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ? |
| 浅色和深色主题 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ? |
| 自定义主题支持 | ✓ | ✓ | ✘ | ✘ | ✘ | ✓ | ✘ |
| 支持 Markdown | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 支持 CSV | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? |
| Git 驱动的静态 pages | [⚙️][gitea-pages-server], [⚙️][gitea-caddy-plugin] | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Git 驱动的集成化 wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ |
| 部署令牌 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 仓库写权限令牌 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| RSS Feeds | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ✘ |
| 内置 CI/CD | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 子组织:组织内的组织 | [](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ |
| 多实例交互 | [/](https://github.com/go-gitea/gitea/issues/18240) | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
| Markdown 绘图 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Markdown 数学公式 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
#### 代码管理
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| ------------------------------------ | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ |
| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 组织里程碑 | [](https://github.com/go-gitea/gitea/issues/14622) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 细粒度用户角色 | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 提交人的身份验证 | | ✘ | ? | ✓ | ✓ | ✓ | ✘ |
| GPG 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| SSH 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ? |
| 拒绝未通过验证的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 外部仓库迁移 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 仓库活跃度页面 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 分支管理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 建立新分支 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 在线代码编辑 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 提交的统计图表 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 模板仓库 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ |
| Git Blame | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| 可视化镜像变化 | ✓ | ✘ | ✓ | ? | ? | ? | ? |
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
| -------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ |
| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 组织里程碑 | [](https://github.com/go-gitea/gitea/issues/14622) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 细粒度用户角色 | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 提交人的身份验证 | | ✘ | ? | ✓ | ✓ | ✓ | ✘ |
| GPG 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| SSH 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ? |
| 拒绝未通过验证的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 外部仓库迁移 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 仓库活跃度页面 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 分支管理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 建立新分支 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 在线代码编辑 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 提交的统计图表 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 模板仓库 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ |
| Git Blame | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| 可视化镜像变化 | ✓ | ✘ | ✓ | ? | ? | ? | ? |
#### 工单管理
@@ -93,7 +93,7 @@ _表格中的符号含义:_
| 工单批处理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 工单看板 | [](https://github.com/go-gitea/gitea/pull/8346) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 从工单创建分支 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 从评论创建工单 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 从评论创建工单 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 工单搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| 工单全局搜索 | [](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| 工单依赖关系 | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
@@ -115,7 +115,7 @@ _表格中的符号含义:_
| Pull/Merge requests 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 查看 Cherry-picking 的更改 | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| 下载 Patch | ✓ | ✘ | ✓ | ✓ | ✓ | [/](https://jira.atlassian.com/plugins/servlet/mobile#issue/BCLOUD-8323) | ✘ |
| Merge queues | ✘ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ |
| Merge queues | ✘ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ |
#### 第三方集成

View File

@@ -20,153 +20,153 @@ aliases:
1. 对于远程数据库设置,您需要让 MySQL 监听您的 IP 地址。编辑数据库实例上的 `/etc/mysql/my.cnf` 文件中的 `bind-address` 选项为:
```ini
bind-address = 203.0.113.3
```
```ini
bind-address = 203.0.113.3
```
2. 在数据库实例上,使用 `root` 用户登录到数据库控制台:
```
mysql -u root -p
```
```
mysql -u root -p
```
按提示输入密码。
按提示输入密码。
3. 创建一个将被 Gitea 使用的数据库用户,并使用密码进行身份验证。以下示例中使用了 `'gitea'` 作为密码。请为您的实例使用一个安全密码。
对于本地数据库:
对于本地数据库:
```sql
SET old_passwords=0;
CREATE USER 'gitea' IDENTIFIED BY 'gitea';
```
```sql
SET old_passwords=0;
CREATE USER 'gitea' IDENTIFIED BY 'gitea';
```
对于远程数据库:
对于远程数据库:
```sql
SET old_passwords=0;
CREATE USER 'gitea'@'192.0.2.10' IDENTIFIED BY 'gitea';
```
```sql
SET old_passwords=0;
CREATE USER 'gitea'@'192.0.2.10' IDENTIFIED BY 'gitea';
```
其中 `192.0.2.10` 是您的 Gitea 实例的 IP 地址。
其中 `192.0.2.10` 是您的 Gitea 实例的 IP 地址。
根据需要替换上述用户名和密码。
根据需要替换上述用户名和密码。
4. 使用 UTF-8 字符集和大小写敏感的排序规则创建数据库。
`utf8mb4_bin` 是 MySQL/MariaDB 的通用排序规则。
Gitea 启动后会尝试把数据库修改为更合适的字符集 (`utf8mb4_0900_as_cs` 或者 `uca1400_as_cs`) 并在可能的情况下更改数据库。
如果你想指定自己的字符集规则,可以在 `app.ini` 中设置 `[database].CHARSET_COLLATION`。
`utf8mb4_bin` 是 MySQL/MariaDB 的通用排序规则。
Gitea 启动后会尝试把数据库修改为更合适的字符集 (`utf8mb4_0900_as_cs` 或者 `uca1400_as_cs`) 并在可能的情况下更改数据库。
如果你想指定自己的字符集规则,可以在 `app.ini` 中设置 `[database].CHARSET_COLLATION`。
```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
```
```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
```
根据需要替换数据库名称。
根据需要替换数据库名称。
5. 将数据库上的所有权限授予上述创建的数据库用户。
对于本地数据库:
对于本地数据库:
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea';
FLUSH PRIVILEGES;
```
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea';
FLUSH PRIVILEGES;
```
对于远程数据库:
对于远程数据库:
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'192.0.2.10';
FLUSH PRIVILEGES;
```
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'192.0.2.10';
FLUSH PRIVILEGES;
```
6. 通过 `exit` 退出数据库控制台。
7. 在您的 Gitea 服务器上,测试与数据库的连接:
```
mysql -u gitea -h 203.0.113.3 -p giteadb
```
```
mysql -u gitea -h 203.0.113.3 -p giteadb
```
其中 `gitea` 是数据库用户名,`giteadb` 是数据库名称,`203.0.113.3` 是数据库实例的 IP 地址。对于本地数据库,省略 `-h` 选项。
其中 `gitea` 是数据库用户名,`giteadb` 是数据库名称,`203.0.113.3` 是数据库实例的 IP 地址。对于本地数据库,省略 `-h` 选项。
到此您应该能够连接到数据库了。
到此您应该能够连接到数据库了。
## PostgreSQL
1. 对于远程数据库设置,通过编辑数据库实例上的 postgresql.conf 文件中的 `listen_addresses` 将 `PostgreSQL` 配置为监听您的 IP 地址:
```ini
listen_addresses = 'localhost, 203.0.113.3'
```
```ini
listen_addresses = 'localhost, 203.0.113.3'
```
2. PostgreSQL 默认使用 `md5` 质询-响应加密方案进行密码身份验证。现在这个方案不再被认为是安全的。改用 SCRAM-SHA-256 方案,通过编辑数据库服务器上的` postgresql.conf` 配置文件:
```ini
password_encryption = scram-sha-256
```
```ini
password_encryption = scram-sha-256
```
重启 PostgreSQL 以应用该设置。
重启 PostgreSQL 以应用该设置。
3. 在数据库服务器上,以超级用户身份登录到数据库控制台:
```
su -c "psql" - postgres
```
```
su -c "psql" - postgres
```
4. 创建具有登录权限和密码的数据库用户(在 PostgreSQL 术语中称为角色)。请使用安全的、强密码,而不是下面的 `'gitea'`
```sql
CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea';
```
```sql
CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea';
```
根据需要替换用户名和密码。
根据需要替换用户名和密码。
5. 使用 UTF-8 字符集创建数据库,并由之前创建的数据库用户拥有。可以根据预期内容使用任何 `libc` 排序规则,使用 `LC_COLLATE` 和 `LC_CTYPE` 参数指定:
```sql
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
```
```sql
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
```
根据需要替换数据库名称。
根据需要替换数据库名称。
6. 通过将以下身份验证规则添加到 `pg_hba.conf`,允许数据库用户访问上面创建的数据库。
对于本地数据库:
对于本地数据库:
```ini
local giteadb gitea scram-sha-256
```
```ini
local giteadb gitea scram-sha-256
```
对于远程数据库:
对于远程数据库:
```ini
host giteadb gitea 192.0.2.10/32 scram-sha-256
```
```ini
host giteadb gitea 192.0.2.10/32 scram-sha-256
```
根据您自己的数据库名称、用户和 Gitea 实例的 IP 地址进行替换。
根据您自己的数据库名称、用户和 Gitea 实例的 IP 地址进行替换。
注意:`pg_hba.conf` 上的规则按顺序评估,也就是第一个匹配的规则将用于身份验证。您的 PostgreSQL 安装可能附带了适用于所有用户和数据库的通用身份验证规则。如果是这种情况,您可能需要将此处提供的规则放置在此类通用规则之上。
注意:`pg_hba.conf` 上的规则按顺序评估,也就是第一个匹配的规则将用于身份验证。您的 PostgreSQL 安装可能附带了适用于所有用户和数据库的通用身份验证规则。如果是这种情况,您可能需要将此处提供的规则放置在此类通用规则之上。
重启 PostgreSQL 以应用新的身份验证规则。
重启 PostgreSQL 以应用新的身份验证规则。
7. 在您的 Gitea 服务器上,测试与数据库的连接。
对于本地数据库:
对于本地数据库:
```
psql -U gitea -d giteadb
```
```
psql -U gitea -d giteadb
```
对于远程数据库:
对于远程数据库:
```
psql "postgres://gitea@203.0.113.3/giteadb"
```
```
psql "postgres://gitea@203.0.113.3/giteadb"
```
其中 `gitea` 是数据库用户,`giteadb` 是数据库名称,`203.0.113.3` 是您的数据库实例的 IP 地址。
其中 `gitea` 是数据库用户,`giteadb` 是数据库名称,`203.0.113.3` 是您的数据库实例的 IP 地址。
您应该会被提示输入数据库用户的密码,并连接到数据库。
您应该会被提示输入数据库用户的密码,并连接到数据库。
## 使用 TLS 进行数据库连接
@@ -185,116 +185,116 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
1. 在数据库实例所在的服务器上,放置以下凭据:
- `/path/to/postgresql.crt`: 数据库实例证书
- `/path/to/postgresql.key`: 数据库实例私钥
- `/path/to/root.crt`: 用于验证客户端证书的CA证书链
- `/path/to/postgresql.crt`: 数据库实例证书
- `/path/to/postgresql.key`: 数据库实例私钥
- `/path/to/root.crt`: 用于验证客户端证书的 CA 证书链
2. 在 `postgresql.conf` 中添加以下选项:
```ini
ssl = on
ssl_ca_file = '/path/to/root.crt'
ssl_cert_file = '/path/to/postgresql.crt'
ssl_key_file = '/path/to/postgresql.key'
ssl_min_protocol_version = 'TLSv1.2'
```
```ini
ssl = on
ssl_ca_file = '/path/to/root.crt'
ssl_cert_file = '/path/to/postgresql.crt'
ssl_key_file = '/path/to/postgresql.key'
ssl_min_protocol_version = 'TLSv1.2'
```
3. 根据 PostgreSQL 的要求,调整凭据的所有权和权限:
```
chown postgres:postgres /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
chmod 0600 /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
```
```
chown postgres:postgres /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
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
```
```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
```
```ini
hostssl giteadb gitea 192.0.2.10/32 scram-sha-256 clientcert=1
```
根据需要替换数据库名称、用户和 Gitea 实例的 IP 地址。
根据需要替换数据库名称、用户和 Gitea 实例的 IP 地址。
5. 重新启动 PostgreSQL 以应用上述配置。
6. 在运行 Gitea 实例的服务器上,将以下凭据放置在运行 Gitea 的用户的主目录下(例如 `git`
- `~/.postgresql/postgresql.crt`: 数据库客户端证书
- `~/.postgresql/postgresql.key`: 数据库客户端私钥
- `~/.postgresql/root.crt`: 用于验证服务器证书的CA证书链
- `~/.postgresql/postgresql.crt`: 数据库客户端证书
- `~/.postgresql/postgresql.key`: 数据库客户端私钥
- `~/.postgresql/root.crt`: 用于验证服务器证书的 CA 证书链
注意:上述文件名在 PostgreSQL 中是硬编码的,无法更改。
注意:上述文件名在 PostgreSQL 中是硬编码的,无法更改。
7. 根据需要调整凭据、所有权和权限:
```
chown git:git ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
chown 0600 ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
```
```
chown git:git ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
chown 0600 ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
```
8. 测试与数据库的连接:
```
psql "postgres://gitea@example.db/giteadb?sslmode=verify-full"
```
```
psql "postgres://gitea@example.db/giteadb?sslmode=verify-full"
```
您将被提示输入数据库用户的密码,然后连接到数据库。
您将被提示输入数据库用户的密码,然后连接到数据库。
### 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/mysql.crt`: 数据库实例证书
- `/path/to/mysql.key`: 数据库实例密钥
- `/path/to/ca.crt`: CA 证书链。在单向 TLS 中不使用此文件,但用于验证双向 TLS 中的客户端证书。
2. 将以下选项添加到 `my.cnf`
```ini
[mysqld]
ssl-ca = /path/to/ca.crt
ssl-cert = /path/to/mysql.crt
ssl-key = /path/to/mysql.key
tls-version = TLSv1.2,TLSv1.3
```
```ini
[mysqld]
ssl-ca = /path/to/ca.crt
ssl-cert = /path/to/mysql.crt
ssl-key = /path/to/mysql.key
tls-version = TLSv1.2,TLSv1.3
```
3. 调整凭据的所有权和权限:
```
chown mysql:mysql /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
chmod 0600 /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
```
```
chown mysql:mysql /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
chmod 0600 /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
```
4. 重新启动MySQL以应用设置。
4. 重新启动 MySQL 以应用设置。
5. Gitea 的数据库用户可能已经创建过,但只会对运行 Gitea 的服务器的 IP 地址进行身份验证。要对其域名进行身份验证,请重新创建用户,并设置其需要通过 TLS 连接到数据库:
```sql
DROP USER 'gitea'@'192.0.2.10';
CREATE USER 'gitea'@'example.gitea' IDENTIFIED BY 'gitea' REQUIRE SSL;
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'example.gitea';
FLUSH PRIVILEGES;
```
```sql
DROP USER 'gitea'@'192.0.2.10';
CREATE USER 'gitea'@'example.gitea' IDENTIFIED BY 'gitea' REQUIRE SSL;
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'example.gitea';
FLUSH PRIVILEGES;
```
根据需要替换数据库用户名、密码和 Gitea 实例域名。
根据需要替换数据库用户名、密码和 Gitea 实例域名。
6. 确保用于验证数据库服务器证书的CA证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
6. 确保用于验证数据库服务器证书的 CA 证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
7. 在运行Gitea的服务器上测试与数据库的连接
7. 在运行 Gitea 的服务器上,测试与数据库的连接:
```
mysql -u gitea -h example.db -p --ssl
```
```
mysql -u gitea -h example.db -p --ssl
```
至此应该成功连接到数据库了。
至此应该成功连接到数据库了。

View File

@@ -35,11 +35,11 @@ chmod +x gitea
## 验证 GPG 签名
Gitea 对打包的二进制文件使用 [GPG密钥](https://keys.openpgp.org/search?q=teabot%40gitea.io) 签名以防止篡改。
Gitea 对打包的二进制文件使用 [GPG 密钥](https://keys.openpgp.org/search?q=teabot%40gitea.io) 签名以防止篡改。
请根据对应文件名 `.asc` 中包含的校验码检验文件的一致性。
```sh
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-@version@-linux-amd64.asc gitea-@version@-linux-amd64
```
@@ -166,7 +166,7 @@ GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
**提示:** 我们不建议使用 SIGKILL 信号(`-9`),这会强制停止 Gitea 程序,但不会正确关闭队列、索引器等任务。
请参阅下面的疑难解答说明以在Gitea版本更新后修复损坏的仓库。
请参阅下面的疑难解答说明,以在 Gitea 版本更新后修复损坏的仓库。
## 排查故障

View File

@@ -8,7 +8,7 @@ aliases:
# 使用源代码安装
你需要 [安装Go](https://golang.google.cn/doc/install) 并正确设置Go环境。特别的建议设置`$GOPATH`环境变量,并将 Go 的二进制目录或目录`${GOPATH//://bin:}/bin`添加到`$PATH`中。请参阅 Go 百科上关于 [GOPATH](https://github.com/golang/go/wiki/GOPATH) 的词条。
你需要 [安装 Go](https://golang.google.cn/doc/install) 并正确设置 Go 环境。特别的,建议设置`$GOPATH`环境变量,并将 Go 的二进制目录或目录`${GOPATH//://bin:}/bin`添加到`$PATH`中。请参阅 Go 百科上关于 [GOPATH](https://github.com/golang/go/wiki/GOPATH) 的词条。
接下来,[安装 Node.js 和 npm](https://nodejs.org/zh-cn/download/) 这是构建 JavaScript 和 CSS 文件所需的。最低支持的 Node.js 版本是 @minNodeVersion@,建议使用最新的 LTS 版本。
@@ -33,7 +33,7 @@ git branch -a
git checkout @sourceBranch@
```
要验证一个拉取请求Pull Request, PR要先启用新的分支其中 `xyz` 是 PR 的 ID例如对于 [#2663](https://github.com/go-gitea/gitea/pull/2663)ID是 `2663 `
要验证一个拉取请求Pull Request, PR要先启用新的分支其中 `xyz` 是 PR 的 ID例如对于 [#2663](https://github.com/go-gitea/gitea/pull/2663)ID `2663 `
```bash
git fetch origin pull/xyz/head:pr-xyz
@@ -55,7 +55,7 @@ git checkout @sourceVersion@ # or git checkout pr-xyz
- `node` @minNodeVersion@ 或更高版本,并且安装 `npm`, 请参阅 [这里](https://nodejs.org/zh-cn/download/)
- `make`, 请参阅 [这里](development/hacking-on-gitea.md)
为了尽可能简化编译过程,提供了各种 [make任务](https://github.com/go-gitea/gitea/blob/main/Makefile)。
为了尽可能简化编译过程,提供了各种 [make 任务](https://github.com/go-gitea/gitea/blob/main/Makefile)。
根据你的构建需求,以下 tags 可以使用:
@@ -103,7 +103,7 @@ Gitea 将从`CustomPath`中查找许多信息。默认的,这会在运行 Gite
尽管在开发时这些值很有用,但可能与下游用户的偏好冲突。
一种选择是使用脚本文件来隐藏`gitea`二进制文件并在运行Gitea之前创建适当的环境。然而在构建时可以使用`make``LDFLAGS`环境变量来更改这些默认值。适当的设置如下:
一种选择是使用脚本文件来隐藏`gitea`二进制文件,并在运行 Gitea 之前创建适当的环境。然而,在构建时,可以使用`make``LDFLAGS`环境变量来更改这些默认值。适当的设置如下:
- 要设置`CustomPath`,请使用`LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.CustomPath=custom-path\""`
- 对于`CustomConf`,应该使用`-X \"code.gitea.io/gitea/modules/setting.CustomConf=conf.ini\"`
@@ -119,7 +119,7 @@ Gitea 将从`CustomPath`中查找许多信息。默认的,这会在运行 Gite
`go`编译器工具链支持将代码交叉编译到不同的目标架构上。请参考[`GOOS`和`GOARCH`环境变量](https://go.dev/doc/install/source#environment) 以获取支持的目标列表。如果您想为性能较弱的系统(如树莓派)构建 Gitea交叉编译非常有用。
要使用构建标签(`TAGS`进行交叉编译Gitea您还需要一个 C 交叉编译器,该编译器的目标架构与`GOOS``GOARCH`变量选择的架构相同。例如,要为 Linux ARM64`GOOS=linux``GOARCH=arm64`)进行交叉编译,您需要`aarch64-unknown-linux-gnu-gcc`交叉编译器。这是因为 Gitea 构建标签使用了`cgo`的外部函数接口FFI
要使用构建标签(`TAGS`)进行交叉编译 Gitea您还需要一个 C 交叉编译器,该编译器的目标架构与`GOOS``GOARCH`变量选择的架构相同。例如,要为 Linux ARM64`GOOS=linux``GOARCH=arm64`)进行交叉编译,您需要`aarch64-unknown-linux-gnu-gcc`交叉编译器。这是因为 Gitea 构建标签使用了`cgo`的外部函数接口FFI
在没有任何标签的情况下,交叉编译的 Gitea 为 Linux ARM64 版本:
@@ -127,7 +127,7 @@ Gitea 将从`CustomPath`中查找许多信息。默认的,这会在运行 Gite
GOOS=linux GOARCH=arm64 make build
```
要交叉编译 Linux ARM64 下的Gitea这是推荐的构建标签
要交叉编译 Linux ARM64 下的 Gitea这是推荐的构建标签
```
CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sqlite_unlock_notify" make build
@@ -213,6 +213,6 @@ make build
默认情况下gitea 会为前端文件生成精简的 Source Map 以节省空间。 这可以通过“ENABLE_SOURCEMAP”环境变量进行控制
- `ENABLE_SOURCEMAP=true` 生成所有Source Map这是开发版本的默认设置
- `ENABLE_SOURCEMAP=reduced` 生成有限的Source Map这是生产版本的默认设置
- `ENABLE_SOURCEMAP=false` 不生成Source Map
- `ENABLE_SOURCEMAP=true` 生成所有 Source Map这是开发版本的默认设置
- `ENABLE_SOURCEMAP=reduced` 生成有限的 Source Map这是生产版本的默认设置
- `ENABLE_SOURCEMAP=false` 不生成 Source Map

View File

@@ -15,9 +15,9 @@ Cloudron 使得在您的服务器上运行 Gitea并保持其更新和安全
[![Install](/cloudron.svg)](https://cloudron.io/button.html?app=io.gitea.cloudronapp)
Gitea软件包的维护地址在[这里](https://git.cloudron.io/cloudron/gitea-app).
Gitea 软件包的维护地址在[这里](https://git.cloudron.io/cloudron/gitea-app).
这里有一个[demo 实例](https://my.demo.cloudron.io) (用户名: cloudron 密码: cloudron) 您可以在其中尝试运行Gitea。
这里有一个[demo 实例](https://my.demo.cloudron.io) (用户名: cloudron 密码: cloudron) 您可以在其中尝试运行 Gitea。
## Linode

View File

@@ -35,15 +35,15 @@ helm install gitea -f values.yaml gitea/gitea
Gitea 附带了一个运行状况检查接口 `/api/healthz`,你可以像这样在 Kubernetes 中配置它:
```yaml
livenessProbe:
httpGet:
path: /api/healthz
port: http
initialDelaySeconds: 200
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
livenessProbe:
httpGet:
path: /api/healthz
port: http
initialDelaySeconds: 200
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
```
成功的运行状况检查响应代码为 HTTP `200`,下面是示例:

View File

@@ -6,7 +6,7 @@ aliases:
- /zh-cn/windows-service
---
# 注册为Windows服务
# 注册为 Windows 服务
## 准备工作
@@ -29,9 +29,9 @@ COMPUTERNAME 是从命令行中运行 `echo %COMPUTERNAME%` 后得到的响应
PATH = c:/gitea/data/gitea.db
```
## 注册为Windows服务
## 注册为 Windows 服务
要注册为Windows服务首先以Administrator身份运行 `cmd`,然后执行以下命令:
要注册为 Windows 服务,首先以 Administrator 身份运行 `cmd`,然后执行以下命令:
```
sc.exe create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"C:\gitea\custom\conf\app.ini\""
@@ -39,7 +39,7 @@ sc.exe create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"
别忘了将 `C:\gitea` 替换成你的 Gitea 安装目录。
之后在控制面板打开 "Windows Services",搜索 "gitea",右键选择 "Run"。在浏览器打开 `http://localhost:3000` 就可以访问了。如果你修改了端口请访问对应的端口3000是默认端口
之后在控制面板打开 "Windows Services",搜索 "gitea",右键选择 "Run"。在浏览器打开 `http://localhost:3000` 就可以访问了。如果你修改了端口请访问对应的端口3000 是默认端口)。
### 服务启动类型
@@ -60,9 +60,9 @@ sc.exe config gitea depend= mariadb
这将确保在 Windows 计算机重新启动时,将延迟自动启动 Gitea直到数据库准备就绪从而减少启动失败的情况。
## 从Windows服务中删除
## 从 Windows 服务中删除
以Administrator身份运行 `cmd`,然后执行以下命令:
Administrator 身份运行 `cmd`,然后执行以下命令:
```
sc.exe delete gitea

View File

@@ -16,7 +16,7 @@ rootless 镜像使用 Gitea 内部 SSH 功能来提供 Git 协议,但不支持
## 基础设置
最简单的设置只需创建一个卷和一个网络,并将 `gitea/gitea:latest-rootless` 镜像作为服务启动。由于没有可用的数据库,可以使用 SQLite3 来初始化一个。
最简单的设置只需创建一个卷和一个网络,并将 `docker.gitea.com/gitea:latest-rootless` 镜像作为服务启动。由于没有可用的数据库,可以使用 SQLite3 来初始化一个。
创建一个名为 `data``config`:
@@ -33,7 +33,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
@@ -45,7 +45,7 @@ services:
- "2222:2222"
```
请注意卷应由在配置文件中指定的UID/GID的用户/组所有。默认情况下Docker中的Gitea将使用uid:1000 gid:1000。如果需要您可以使用以下命令设置这些文件夹的所有权
请注意,卷应由在配置文件中指定的 UID/GID 的用户/组所有。默认情况下Docker 中的 Gitea 将使用 uid:1000 gid:1000。如果需要您可以使用以下命令设置这些文件夹的所有权
```sh
sudo chown 1000:1000 config/ data/
@@ -53,18 +53,18 @@ sudo chown 1000:1000 config/ data/
> 如果未为卷设置正确的权限,容器可能无法启动。
对于稳定版本,您可以使用 `:latest-rootless``:1-rootless`,或指定特定的版本,如: `@dockerVersion@-rootless`。如果您想使用最新的开发版本,则可以使用 `:dev-rootless` 标签。如果您想运行发布分支的最新提交,可以使用 `:1.x-dev-rootless` 标签,其中 x是 Gitea 的次要版本号(例如:`1.16-dev-rootless`)。
对于稳定版本,您可以使用 `:latest-rootless``:1-rootless`,或指定特定的版本,如: `@dockerVersion@-rootless`。如果您想使用最新的开发版本,则可以使用 `:dev-rootless` 标签。如果您想运行发布分支的最新提交,可以使用 `:1.x-dev-rootless` 标签,其中 x 是 Gitea 的次要版本号(例如:`1.16-dev-rootless`)。
## 自定义端口
要将集成的SSHWeb服务器绑定到不同的端口请调整端口部分。通常只需更改主机端口并保持容器内的端口不变。
要将集成的 SSHWeb 服务器绑定到不同的端口,请调整端口部分。通常只需更改主机端口并保持容器内的端口不变。
```diff
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
@@ -87,7 +87,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
@@ -127,7 +127,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
@@ -172,7 +172,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
@@ -199,7 +199,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
+ user: 1001
volumes:
@@ -252,13 +252,13 @@ docker-compose up -d
- 将卷中的文件夹gitea重命名为 custom
- 如果需要,编辑 `app.ini`
- 设置 `START_SSH_SERVER = true`
- 使用镜像 ` docker.io/gitea/gitea:@dockerVersion@-rootless`
- 使用镜像 ` docker.gitea.com/gitea:@dockerVersion@-rootless`
## 使用环境变量管理部署
除了上述的环境变量外,`app.ini` 中的任何设置都可以通过形式为 `GITEA__SECTION_NAME__KEY_NAME` 的环境变量进行设置或覆盖。这些设置在每次 Docker 容器启动时都会生效。完整信息请参考[这里](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini).
这些环境变量可以在 `docker-compose.yml` 中传递给 Docker 容器。以下示例将启用 SMTP 邮件服务器,如果主机上设置了所需的环境变量 GITEA__mailer__FROM、GITEA__mailer__HOST、GITEA__mailer__PASSWD或者在与 `docker-compose.yml` 相同目录中的 `.env` 文件中设置了这些环境变量:
这些环境变量可以在 `docker-compose.yml` 中传递给 Docker 容器。以下示例将启用 SMTP 邮件服务器,如果主机上设置了所需的环境变量 GITEA**mailer**FROM、GITEA**mailer**HOST、GITEA**mailer**PASSWD或者在与 `docker-compose.yml` 相同目录中的 `.env` 文件中设置了这些环境变量:
```bash
...

View File

@@ -14,7 +14,7 @@ Gitea 在其 Docker Hub 组织内提供自动更新的 Docker 镜像。可以始
## 基本
最简单的设置只是创建一个卷和一个网络,然后将 `gitea/gitea:latest` 镜像作为服务启动。由于没有可用的数据库,因此可以使用 SQLite3 初始化数据库。创建一个类似 `gitea` 的目录,并将以下内容粘贴到名为 `docker-compose.yml` 的文件中。请注意,该卷应由配置文件中指定的 UID/GID 的用户/组拥有。如果您不授予卷正确的权限,则容器可能无法启动。另请注意,标签 `:latest` 将安装当前的开发版本。对于稳定的发行版,您可以使用 `:1` 或指定某个发行版,例如 `@dockerVersion@`
最简单的设置只是创建一个卷和一个网络,然后将 `docker.gitea.com/gitea:latest` 镜像作为服务启动。由于没有可用的数据库,因此可以使用 SQLite3 初始化数据库。创建一个类似 `gitea` 的目录,并将以下内容粘贴到名为 `docker-compose.yml` 的文件中。请注意,该卷应由配置文件中指定的 UID/GID 的用户/组拥有。如果您不授予卷正确的权限,则容器可能无法启动。另请注意,标签 `:latest` 将安装当前的开发版本。对于稳定的发行版,您可以使用 `:1` 或指定某个发行版,例如 `@dockerVersion@`
```yaml
version: "3"
@@ -25,7 +25,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -55,7 +55,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -89,7 +89,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -139,7 +139,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -192,7 +192,7 @@ networks:
+
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
restart: always
networks:
@@ -291,12 +291,12 @@ Gitea 将为每次新安装自动生成新的 `SECRET_KEY` 并将它们写入 `a
以下命令将向 `stdout` 输出一个新的 `SECRET_KEY``INTERNAL_TOKEN`,然后您可以将其放入环境变量中。
```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
...
---
services:
server:
environment:
@@ -343,7 +343,7 @@ ports:
- "127.0.0.1:2222:22"
```
另外,主机上的 `/home/git/.ssh/authorized_keys` 需要修改。它需要以与 Gitea 容器内的 `authorized_keys` 相同的方式进行操作。因此将您在上面创建的密钥“Gitea 主机密钥”)的公共密钥添加到 `~/git/.ssh/authorized_keys`。这可以通过 `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys` 完成。重要提示:来自 `git` 用户的公钥需要“按原样”添加,而通过 Gitea 网络界面添加的所有其他公钥将以 `command="/app [...]` 作为前缀。
另外,主机上的 `/home/git/.ssh/authorized_keys` 需要修改。它需要以与 Gitea 容器内的 `authorized_keys` 相同的方式进行操作。因此将您在上面创建的密钥“Gitea 主机密钥”)的公共密钥添加到 `/home/git/.ssh/authorized_keys`。这可以通过 `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys` 完成。重要提示:来自 `git` 用户的公钥需要“按原样”添加,而通过 Gitea 网络界面添加的所有其他公钥将以 `command="/app [...]` 作为前缀。
该文件应该看起来像:

View File

@@ -5,7 +5,6 @@ slug: "clone-filters"
sidebar_position: 25
aliases:
- /zh-cn/clone-filters
---
# 克隆过滤器 (部分克隆)

View File

@@ -5,7 +5,6 @@ slug: "incoming-email"
sidebar_position: 13
aliases:
- /zh-cn/incoming-email
---
# 邮件接收

View File

@@ -100,16 +100,13 @@ Gitea 支持两种格式的模板Markdown 和 YAML。
```md
---
name: "Template Name"
about: "This template is for testing!"
title: "[TEST] "
ref: "main"
labels:
- bug
- "help needed"
- bug
- "help needed"
---
This is the template!

View File

@@ -90,11 +90,11 @@ aliases:
- `m` - 分钟
- `h` - 小时
- `d` - 天(相当于8小时)
- `w` - 周(相当于5天)
- `mo` - 月(相当于4周)
- `d` - 天(相当于 8 小时)
- `w` - 周(相当于 5 天)
- `mo` - 月(相当于 4 周)
用于指定时间的数字(`<number>`)也可以是小数,例如 `@1.5h` 表示一小时半。多个时间单位可以结合使用,例如 `@1h10m` 表示1小时10分钟。
用于指定时间的数字(`<number>`)也可以是小数,例如 `@1.5h` 表示一小时半。多个时间单位可以结合使用,例如 `@1h10m` 表示 1 小时 10 分钟。
提交消息示例:
@@ -115,26 +115,26 @@ Gitea 支持使用外部工单跟踪器,并可以在合并请求中创建对
下表说明了工单和合并请求的不同类型的交叉引用。在示例中,`User1/Repo1` 指的是使用引用的仓库,而 `UserZ/RepoZ` 表示另一个仓库。
| 在 User1/Repo1 中的引用 | Repo1 的工单是外部的 | RepoZ 的工单是外部的 | 渲染效果 |
| ----------------------- | :-------------------: | :-------------------: | ------------------------------------------------ |
| `#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `UserZ/RepoZ#1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ!1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ#1234` | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ 1234 |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ`_PR_ 1234 |
| **字母数字工单编号:** | - | - | - |
| `AAA-1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ `AAA-1234` |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| _不支持_ | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ `AAA-1234` |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ` 中的 _PR_ 1234 |
| 在 User1/Repo1 中的引用 | Repo1 的工单是外部的 | RepoZ 的工单是外部的 | 渲染效果 |
| ----------------------- | :------------------: | :------------------: | --------------------------------------------- |
| `#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `UserZ/RepoZ#1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ!1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ#1234` | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ 1234 |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ`_PR_ 1234 |
| **字母数字工单编号:** | - | - | - |
| `AAA-1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ `AAA-1234` |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| _不支持_ | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ `AAA-1234` |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ` 中的 _PR_ 1234 |
_最后一部分适用于使用字母数字格式的外部工单跟踪器的仓库。_

View File

@@ -5,7 +5,6 @@ sidebar_position: 15
aliases:
- /zh-cn/merge-message-templates
---
# 合并消息模板

View File

@@ -14,35 +14,35 @@ Gitea 支持对仓库进行权限管理,这样您就可以为不同的人员
在 Gitea 中,我们将仓库的子模块称为 `单元Unit`。现在我们有以下几个单元。
| 名称 | 描述 | 权限 |
| ----------------- | --------------------------------------------------- | ------------ |
| 代码 | 访问源代码、文件、提交和分支。 | 读取 写入 |
| 工单 | 组织缺陷报告、任务和里程碑。 | 读取 写入 |
| 合并请求 | 启用合并请求和代码审核。 | 读取 写入 |
| 发布 | 跟踪项目版本和下载。 | 读取 写入 |
| 百科 | 与协作者编写和共享文档。 | 读取 写入 |
| 外部百科 | 链接到外部维基。 | 读取 |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | 读取 |
| 项目 | 模板仓库的 URL。 | 读取 写入 |
| 包 | 链接到仓库 | 读取 写入 |
| Actions | 审查Actions日志或重启/取消工作流 | 读取 写入 |
| 设置 | 管理仓库。 | 管理员 |
| 名称 | 描述 | 权限 |
| -------------- | ---------------------------------- | --------- |
| 代码 | 访问源代码、文件、提交和分支。 | 读取 写入 |
| 工单 | 组织缺陷报告、任务和里程碑。 | 读取 写入 |
| 合并请求 | 启用合并请求和代码审核。 | 读取 写入 |
| 发布 | 跟踪项目版本和下载。 | 读取 写入 |
| 百科 | 与协作者编写和共享文档。 | 读取 写入 |
| 外部百科 | 链接到外部维基。 | 读取 |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | 读取 |
| 项目 | 模板仓库的 URL。 | 读取 写入 |
| 包 | 链接到仓库 | 读取 写入 |
| Actions | 审查 Actions 日志或重启/取消工作流 | 读取 写入 |
| 设置 | 管理仓库。 | 管理员 |
通过不同的权限,用户可以在这些单元上执行不同的操作。
| 名称 | 读取 | 写入 | 管理员 |
| ----------------- | -------------------------------------------------- | ------------------------------ | ------------------------- |
| 代码 | 查看代码树、文件、提交、分支等。 | 推送代码。 | - |
| 工单 | 查看工单并创建新工单。 | 添加标签、分配、关闭工单。 | - |
| 合并请求 | 查看合并请求并创建新合并请求。 | 添加标签、分配、关闭合并请求。 | - |
| 发布 | 查看发布和下载文件。 | 创建/编辑发布。 | - |
| 百科 | 查看百科页面。克隆百科仓库。 | 创建/编辑百科页面,推送更改。 | - |
| 外部百科 | 链接到外部百科。 | - | - |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | - | - |
| 项目 | 查看面板。 | 在面板之间移动工单。 | - |
| 包 | 查看包 | 上传/删除包 | - |
| Actions | 查看 Actions日志 | 同意 / 取消 / 重启 | - |
| 设置 | - | - | 管理仓库 |
| 名称 | 读取 | 写入 | 管理员 |
| -------------- | -------------------------------- | ------------------------------ | -------- |
| 代码 | 查看代码树、文件、提交、分支等。 | 推送代码。 | - |
| 工单 | 查看工单并创建新工单。 | 添加标签、分配、关闭工单。 | - |
| 合并请求 | 查看合并请求并创建新合并请求。 | 添加标签、分配、关闭合并请求。 | - |
| 发布 | 查看发布和下载文件。 | 创建/编辑发布。 | - |
| 百科 | 查看百科页面。克隆百科仓库。 | 创建/编辑百科页面,推送更改。 | - |
| 外部百科 | 链接到外部百科。 | - | - |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | - | - |
| 项目 | 查看面板。 | 在面板之间移动工单。 | - |
| 包 | 查看包 | 上传/删除包 | - |
| Actions | 查看 Actions 日志 | 同意 / 取消 / 重启 | - |
| 设置 | - | - | 管理仓库 |
个人仓库和组织仓库之间的权限存在一些差异。

View File

@@ -25,17 +25,17 @@ aliases:
示例:
| 类型 | 模式受保护的标签 | 可能匹配的标签 |
| 类型 | 模式受保护的标签 | 可能匹配的标签 |
| ----- | ------------------------ | --------------------------------------- |
| Glob | `v*` | `v``v-1``version2` |
| Glob | `v[0-9]` | `v0``v1``v9` |
| Glob | `v[0-9]` | `v0``v1``v9` |
| Glob | `*-release` | `2.1-release``final-release` |
| Glob | `gitea` | 仅限 `gitea` |
| Glob | `*gitea*` | `gitea``2.1-gitea``1_gitea-release` |
| Glob | `{v,rel}-*` | `v-``v-1``v-final``rel-``rel-x` |
| Glob | `*` | 匹配所有可能的标签名称 |
| Glob | `*` | 匹配所有可能的标签名称 |
| Regex | `/\Av/` | `v``v-1``version2` |
| Regex | `/\Av[0-9]\z/` | `v0``v1``v9` |
| Regex | `/\Av[0-9]\z/` | `v0``v1``v9` |
| Regex | `/\Av\d+\.\d+\.\d+\z/` | `v1.0.17``v2.1.0` |
| Regex | `/\Av\d+(\.\d+){0,2}\z/` | `v1``v2.1``v1.2.34` |
| Regex | `/-release\z/` | `2.1-release``final-release` |
@@ -43,4 +43,4 @@ aliases:
| Regex | `/\Agitea\z/` | 仅限 `gitea` |
| Regex | `/^gitea$/` | 仅限 `gitea` |
| Regex | `/\A(v\|rel)-/` | `v-``v-1``v-final``rel-``rel-x` |
| Regex | `/.+/` | 匹配所有可能的标签名称 |
| Regex | `/.+/` | 匹配所有可能的标签名称 |

View File

@@ -17,15 +17,15 @@ aliases:
要创建合并请求,您需要遵循以下步骤:
1. **Fork 仓库** - 如果您没有直接对仓库进行更改的权限,您需要将仓库 fork 到您自己的账户中。
这将创建一个您可以对其进行更改的仓库副本。
这将创建一个您可以对其进行更改的仓库副本。
2. **创建分支(可选)** - 在 fork 的仓库中创建一个新分支,该分支包含您要提出的更改。
给分支取一个描述性的名称,以指示更改的内容。
给分支取一个描述性的名称,以指示更改的内容。
3. **进行更改** - 进行您想要的更改,提交并将其推送到 fork 的仓库中。
4. **创建合并请求** - 转到原始仓库并转到“合并请求”选项卡。单击“新建合并请求”按钮,并将您的新分支选择为源分支。
为您的合并请求输入描述性标题和描述,然后单击“创建合并请求”。
为您的合并请求输入描述性标题和描述,然后单击“创建合并请求”。
## 评审合并请求

View File

@@ -53,7 +53,7 @@ aliases:
要从 Gitea 设置镜像到 GitHub您需要按照以下步骤进行操作
1. 创建一个具有选中 *public_repo* 选项的 [GitHub 个人访问令牌](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)。
1. 创建一个具有选中 _public_repo_ 选项的 [GitHub 个人访问令牌](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)。
2. 在 GitHub 上创建一个同名的仓库。与 Gitea 不同GitHub 不支持通过推送到远程来创建仓库。如果您的现有远程仓库与您的 Gitea 仓库具有相同的提交历史,您也可以使用现有的远程仓库。
3. 在您的 Gitea 仓库设置中,填写**Git 远程仓库 URL**`https://github.com/<your_github_group>/<your_github_project>.git`
4. 使用您的 GitHub 用户名填写**授权**字段,并将个人访问令牌作为**密码**。
@@ -66,7 +66,7 @@ aliases:
要从 Gitea 设置镜像到 GitLab您需要按照以下步骤进行操作
1. 创建具有 *write_repository* 作用域的 [GitLab 个人访问令牌](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)。
1. 创建具有 _write_repository_ 作用域的 [GitLab 个人访问令牌](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)。
2. 填写**Git 远程仓库 URL**`https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git`
3. 在**授权**字段中填写 `oauth2` 作为**用户名**,并将您的 GitLab 个人访问令牌作为**密码**。
4. 选择**添加推送镜像**以保存配置。
@@ -77,7 +77,7 @@ aliases:
要从 Gitea 设置镜像到 Bitbucket您需要按照以下步骤进行操作
1. 创建一个具有选中 *Repository Write* 选项的 [Bitbucket 应用密码](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)。
1. 创建一个具有选中 _Repository Write_ 选项的 [Bitbucket 应用密码](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)。
2. 填写**Git 远程仓库 URL**`https://bitbucket.org/<your_bitbucket_group_or_name>/<your_bitbucket_project>.git`
3. 使用您的 Bitbucket 用户名填写**授权**字段,并将应用密码作为**密码**。
4. 选择**添加推送镜像**以保存配置。

View File

@@ -42,20 +42,20 @@ a/b/c/d.json
所有变量都必须采用`$VAR``${VAR}`的形式。要转义扩展,使用双重`$$`,例如`$$VAR``$${VAR}`
| 变量 | 扩展为 | 可转换 |
| -------------------- | --------------------------------------------------- | ------------- |
| REPO_NAME | 生成的仓库名称 | ✓ |
| TEMPLATE_NAME | 模板仓库名称 | ✓ |
| REPO_DESCRIPTION | 生成的仓库描述 | ✘ |
| TEMPLATE_DESCRIPTION | 模板仓库描述 | ✘ |
| REPO_OWNER | 生成的仓库所有者 | ✓ |
| TEMPLATE_OWNER | 模板仓库所有者 | ✓ |
| REPO_LINK | 生成的仓库链接 | ✘ |
| TEMPLATE_LINK | 模板仓库链接 | ✘ |
| REPO_HTTPS_URL | 生成的仓库的 HTTP(S) 克隆链接 | ✘ |
| TEMPLATE_HTTPS_URL | 模板仓库的 HTTP(S) 克隆链接 | ✘ |
| REPO_SSH_URL | 生成的仓库的 SSH 克隆链接 | ✘ |
| TEMPLATE_SSH_URL | 模板仓库的 SSH 克隆链接 | ✘ |
| 变量 | 扩展为 | 可转换 |
| -------------------- | ----------------------------- | ------ |
| REPO_NAME | 生成的仓库名称 | ✓ |
| TEMPLATE_NAME | 模板仓库名称 | ✓ |
| REPO_DESCRIPTION | 生成的仓库描述 | ✘ |
| TEMPLATE_DESCRIPTION | 模板仓库描述 | ✘ |
| REPO_OWNER | 生成的仓库所有者 | ✓ |
| TEMPLATE_OWNER | 模板仓库所有者 | ✓ |
| REPO_LINK | 生成的仓库链接 | ✘ |
| TEMPLATE_LINK | 模板仓库链接 | ✘ |
| REPO_HTTPS_URL | 生成的仓库的 HTTP(S) 克隆链接 | ✘ |
| TEMPLATE_HTTPS_URL | 模板仓库的 HTTP(S) 克隆链接 | ✘ |
| REPO_SSH_URL | 生成的仓库的 SSH 克隆链接 | ✘ |
| TEMPLATE_SSH_URL | 模板仓库的 SSH 克隆链接 | ✘ |
## 转换器 :robot:
@@ -65,12 +65,12 @@ Gitea `1.12.0` 添加了一些转换器以应用于上述适用的变量。
`go-sdk` 传递给可用的转换器的效果如下...
| 转换器 | 效果 |
| ----------- | ------------ |
| SNAKE | go_sdk |
| KEBAB | go-sdk |
| CAMEL | goSdk |
| PASCAL | GoSdk |
| LOWER | go-sdk |
| UPPER | GO-SDK |
| TITLE | Go-Sdk |
| 转换器 | 效果 |
| ------ | ------ |
| SNAKE | go_sdk |
| KEBAB | go-sdk |
| CAMEL | goSdk |
| PASCAL | GoSdk |
| LOWER | go-sdk |
| UPPER | GO-SDK |
| TITLE | Go-Sdk |

View File

@@ -8,7 +8,7 @@ aliases:
# Webhooks
Gitea支持用于仓库事件的Webhooks。这可以在仓库管理员在设置页面 `/:username/:reponame/settings/hooks` 中进行配置。Webhooks还可以基于组织和整个系统进行配置。
Gitea 支持用于仓库事件的 Webhooks。这可以在仓库管理员在设置页面 `/:username/:reponame/settings/hooks` 中进行配置。Webhooks 还可以基于组织和整个系统进行配置。
所有事件推送都是 POST 请求。目前支持:
- Gitea (也可以是 GET 请求)
@@ -26,7 +26,7 @@ Gitea支持用于仓库事件的Webhooks。这可以在仓库管理员在设置
**警告**:自 Gitea 1.13.0 版起payload 中的 `secret` 字段已被弃用,并将在 1.14.0 版中移除https://github.com/go-gitea/gitea/issues/11755
以下是 Gitea 将发送给 payload URL的事件信息示例
以下是 Gitea 将发送给 payload URL 的事件信息示例:
```http
X-GitHub-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
@@ -182,4 +182,4 @@ if (json_last_error() !== JSON_ERROR_NONE) {
### 授权头Authorization header
**从1.19版本开始**Gitea 的 Webhook 可以配置为向 Webhook 目标发送一个 [授权头authorization header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization)。
**从 1.19 版本开始**Gitea 的 Webhook 可以配置为向 Webhook 目标发送一个 [授权头authorization header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization)。

View File

@@ -59,7 +59,7 @@ aliases:
- 选项:
- `--email`:要删除的用户的电子邮件。
- `--username`:要删除的用户的用户名。
- `--id`要删除的用户的ID。
- `--id`:要删除的用户的 ID。
- 必须提供 `--id``--username``--email` 中的一个。如果提供多个,则所有条件必须匹配。
- 示例:
- `gitea admin user delete --id 1`
@@ -168,11 +168,11 @@ aliases:
- `--allowed-domains`:留空以允许所有域。使用逗号(',')分隔多个域。
- `--skip-local-2fa`:跳过 2FA 登录。
- `--active`:启用此认证源。
备注:
`--force-smtps``--skip-verify``--disable-helo``--skip-local-2fs``--active` 选项可以采用以下形式使用:
备注:
`--force-smtps``--skip-verify``--disable-helo``--skip-local-2fs``--active` 选项可以采用以下形式使用:
- `--option``--option=true` 以启用选项
- `--option=false` 以禁用选项
如果未指定这些选项,则在 `update-smtp` 中不会更改值,或者在 `add-smtp` 中将使用默认的 `false` 值。
如果未指定这些选项,则在 `update-smtp` 中不会更改值,或者在 `add-smtp` 中将使用默认的 `false` 值。
- 示例:
- `gitea admin auth add-smtp --name ldap --host smtp.mydomain.org --port 587 --skip-verify --active`
- `update-smtp`
@@ -281,12 +281,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则忽略此选项。默认值2048
- `--host value`:逗号分隔的主机名和 IP 地址列表,此证书适用于这些主机。支持使用通配符。必填。
- `--ecdsa-curve value`:用于生成密钥的 ECDSA 曲线。可选。有效选项为 P224、P256、P384、P521。
- `--rsa-bits value`:要生成的 RSA 密钥的大小。可选。如果设置了--ecdsa-curve则忽略此选项。默认值2048
- `--start-date value`:证书的创建日期。可选。(格式:`Jan 1 15:04:05 2011`)。
- `--duration value`证书有效期。可选。默认值8760h0m0s
- `--ca`:如果提供此选项,则证书将生成自己的证书颁发机构。可选。
@@ -295,18 +295,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
- 示例:
@@ -409,19 +409,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`
@@ -437,7 +437,7 @@ gitea doctor recreate-table
- `--expression value`, `-e value`: 日志记录器的匹配表达式
- `--prefix value`, `-p value`: 日志记录器的前缀
- `--color`: 在日志中使用颜色
- `--stderr`: 将控制台日志输出到stderr - 仅适用于控制台
- `--stderr`: 将控制台日志输出到 stderr - 仅适用于控制台
- `file`: 添加文件日志记录器
- 选项:
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
@@ -467,9 +467,9 @@ gitea doctor recreate-table
- `--color`: 在日志中使用颜色
- `--reconnect-on-message`, `-R`: 对于每个消息重新连接主机
- `--reconnect`, `-r`: 连接中断时重新连接主机
- `--protocol value`, `-P value`: 设置要使用的协议tcp、unixudp默认为tcp
- `--protocol value`, `-P value`: 设置要使用的协议tcp、unixudp默认为 tcp
- `--address value`, `-a value`: 要连接到的主机地址和端口(默认为:7020
- `smtp`: 添加SMTP日志记录器
- `smtp`: 添加 SMTP 日志记录器
- 选项:
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式

View File

@@ -14,9 +14,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]
@@ -54,9 +54,9 @@ PASSWD = `password`
- 通过端口 587 的 STARTTLS也称为 Opportunistic TLS。初始连接是明文的但如果服务器支持则可以升级为 TLS。
- 通过默认端口 465 的 SMTPS 连接。连接到服务器从一开始就使用 TLS。
- 使用 `IS_TLS_ENABLED=true` 进行强制的 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

View File

@@ -22,7 +22,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 +171,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;

View File

@@ -17,18 +17,18 @@ aliases:
目前,以下通知事件使用模板:
| 操作名称 | 用途 |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| `new` | 创建了新的工单或合并请求。 |
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
| `close` | 关闭了工单或合并请求。 |
| `reopen` | 重新打开了工单或合并请求。 |
| `review` | 在合并请求中进行审查的首要评论。 |
| `approve` | 对合并请求进行批准的首要评论。 |
| `reject` | 对合并请求提出更改请求的审查的首要评论。 |
| `code` | 关于合并请求的代码的单个评论。 |
| `assigned` | 用户被分配到工单或合并请求。 |
| `default` | 未包括在上述类别中的任何操作,或者当对应类别的模板不存在时使用的模板。 |
| 操作名称 | 用途 |
| ---------- | ---------------------------------------------------------------------- |
| `new` | 创建了新的工单或合并请求。 |
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
| `close` | 关闭了工单或合并请求。 |
| `reopen` | 重新打开了工单或合并请求。 |
| `review` | 在合并请求中进行审查的首要评论。 |
| `approve` | 对合并请求进行批准的首要评论。 |
| `reject` | 对合并请求提出更改请求的审查的首要评论。 |
| `code` | 关于合并请求的代码的单个评论。 |
| `assigned` | 用户被分配到工单或合并请求。 |
| `default` | 未包括在上述类别中的任何操作,或者当对应类别的模板不存在时使用的模板。 |
特定消息类型的模板路径为:
@@ -72,25 +72,25 @@ custom/templates/mail/pull/comment.tmpl
指定 _主题_ 部分是可选的因此也是虚线分隔符。在使用时_主题_ 和 _邮件正文_ 模板之间的分隔符需要至少三个虚线;分隔符行中不允许使用其他字符。
_主题__邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
_主题__邮件正文_ 由 [Golang 的模板引擎](https://golang.org/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
| 名称 | 类型 | 可用性 | 用途 |
| -------------------- | ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_ |
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
| `.Link` | string | 始终可用 | 源工单、合并请求或评论的地址。 |
| `.Issue` | models.Issue | 始终可用 | 产生通知的工单(或合并请求)。要获取特定于合并请求的数据(例如 `HasMerged`),可以使用 `.Issue.PullRequest`,但需要注意,如果工单 _不是_ 合并请求,则该字段将为 `nil` |
| `.Comment` | models.Comment | 如果适用 | 如果通知是针对添加到工单或合并请求的评论,则其中包含有关评论的信息。 |
| `.IsPull` | bool | 始终可用 | 如果邮件通知与合并请求关联(即 `.Issue.PullRequest` 不为 `nil` ),则为 `true` |
| `.Repo` | string | 始终可用 | 仓库的名称,包括所有者名称(例如 `mike/stuff` |
| `.User` | models.User | 始终可用 | 事件来源仓库的所有者。要获取用户名(例如 `mike`),可以使用 `.User.Name` |
| `.Doer` | models.User | 始终可用 | 执行触发通知事件的操作的用户。要获取用户名(例如 `rhonda`),可以使用 `.Doer.Name` |
| `.IsMention` | bool | 始终可用 | 如果此通知仅是因为在评论中提到了用户而生成的,并且收件人未订阅源,则为 `true`。如果收件人已订阅工单或仓库,则为 `false` |
| `.SubjectPrefix` | string | 始终可用 | 如果通知是关于除工单或合并请求创建之外的其他内容,则为 `Re`;否则为空字符串。 |
| `.ActionType` | string | 始终可用 | `"issue"``"pull"`。它将与实际的 _操作类型_ 对应,与选择的模板无关。 |
| `.ActionName` | string | 始终可用 | 它将是上述操作类型之一(`new` `comment` 等),并与选择的模板对应。 |
| `.ReviewComments` | []models.Comment | 始终可用 | 审查中的代码评论列表。评论文本将在 `.RenderedContent` 中,引用的代码将在 `.Patch` 中。 |
| 名称 | 类型 | 可用性 | 用途 |
| ------------------ | ---------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_。 |
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
| `.Link` | string | 始终可用 | 源工单、合并请求或评论的地址。 |
| `.Issue` | models.Issue | 始终可用 | 产生通知的工单(或合并请求)。要获取特定于合并请求的数据(例如 `HasMerged`),可以使用 `.Issue.PullRequest`,但需要注意,如果工单 _不是_ 合并请求,则该字段将为 `nil`。 |
| `.Comment` | models.Comment | 如果适用 | 如果通知是针对添加到工单或合并请求的评论,则其中包含有关评论的信息。 |
| `.IsPull` | bool | 始终可用 | 如果邮件通知与合并请求关联(即 `.Issue.PullRequest` 不为 `nil` ),则为 `true`。 |
| `.Repo` | string | 始终可用 | 仓库的名称,包括所有者名称(例如 `mike/stuff` |
| `.User` | models.User | 始终可用 | 事件来源仓库的所有者。要获取用户名(例如 `mike`),可以使用 `.User.Name`。 |
| `.Doer` | models.User | 始终可用 | 执行触发通知事件的操作的用户。要获取用户名(例如 `rhonda`),可以使用 `.Doer.Name`。 |
| `.IsMention` | bool | 始终可用 | 如果此通知仅是因为在评论中提到了用户而生成的,并且收件人未订阅源,则为 `true`。如果收件人已订阅工单或仓库,则为 `false`。 |
| `.SubjectPrefix` | string | 始终可用 | 如果通知是关于除工单或合并请求创建之外的其他内容,则为 `Re`;否则为空字符串。 |
| `.ActionType` | string | 始终可用 | `"issue"``"pull"`。它将与实际的 _操作类型_ 对应,与选择的模板无关。 |
| `.ActionName` | string | 始终可用 | 它将是上述操作类型之一(`new` `comment` 等),并与选择的模板对应。 |
| `.ReviewComments` | []models.Comment | 始终可用 | 审查中的代码评论列表。评论文本将在 `.RenderedContent` 中,引用的代码将在 `.Patch` 中。 |
所有名称区分大小写。
@@ -107,7 +107,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
- 删除所有前导、尾随和多余的空格。
- 将字符串截断为前 256 个字母(字符)。
如果最终结果为空字符串,**或者**没有可用的主题模板即所选模板不包含主题部分将使用Gitea的**内部默认值**。
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用 Gitea 的**内部默认值**。
内部默认(回退)主题相当于:
@@ -117,7 +117,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
例如:`Re: [mike/stuff] New color palette (#38)`
即使存在有效的主题模板Gitea的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
即使存在有效的主题模板Gitea 的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
### 模板中的邮件正文部分
@@ -139,7 +139,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
如果模板无法呈现,则只有在发送邮件时才会注意到。
如果主题模板失败,将使用默认主题,如果从 _邮件正文_ 中成功呈现了任何内容,则将使用该内容,忽略其他内容。
如果遇到问题,请检查 [Gitea的日志](https://docs.gitea.io/en-us/logging-configuration/) 以获取错误消息。
如果遇到问题,请检查 [Gitea 的日志](https://docs.gitea.io/en-us/logging-configuration/) 以获取错误消息。
## 示例
@@ -221,11 +221,11 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
>
> #### 消息内容:
>
> \_********************************\_********************************
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
>
> Mike, I think we should tone down the blues a little.
>
> \_********************************\_********************************
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
>
> [在 Gitea 上查看](#)。
@@ -233,20 +233,22 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
模板系统包含一些函数,可用于进一步处理和格式化消息。以下是其中一些函数的列表:
| 函数名 | 参数 | 可用于 | 用法 |
| ----------------- | ----------- | ------------ | --------------------------------------------------------------------------------- |
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
| `EllipsisString` | string, int | 任何地方 | 将字符串截断为指定长度;根据需要添加省略号 |
| `Str2html` | string | 仅正文部分 | 通过删除其中的 HTML 标签对文本进行清理 |
| `Safe` | string | 仅正文部分 | 将输入作为 HTML 处理;可用于 `.ReviewComments.RenderedContent` 等字段 |
| 函数名 | 参数 | 可用于 | 用法 |
| ---------------- | ----------- | ---------- | --------------------------------------------------------------------- |
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
| `EllipsisString` | string, int | 任何地方 | 将字符串截断为指定长度;根据需要添加省略号 |
| `Str2html` | string | 仅正文部分 | 通过删除其中的 HTML 标签对文本进行清理 |
| `Safe` | string | 仅正文部分 | 将输入作为 HTML 处理;可用于 `.ReviewComments.RenderedContent` 等字段 |
这些都是 _函数_,而不是元数据,因此必须按以下方式使用:
```html
像这样使用: {{Str2html "Escape<my>text"}}
或者这样使用: {{"Escape<my>text" | Str2html}}
或者这样使用: {{AppUrl}}
但不要像这样使用: {{.AppUrl}}
像这样使用: {{Str2html "Escape<my
>text"}} 或者这样使用: {{"Escape<my
>text" | Str2html}} 或者这样使用: {{AppUrl}} 但不要像这样使用:
{{.AppUrl}}</my
></my
>
```

View File

@@ -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 等)污染,从而使搜索结果更相关。这还有助于减小索引的大小。

View File

@@ -22,7 +22,7 @@ User-agent: *
Disallow: /
```
如果您将Gitea安装在子目录中则需要在顶级目录中创建或编辑 `robots.txt`
如果您将 Gitea 安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`
```txt
User-agent: *

View File

@@ -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`

View File

@@ -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`将被GitOpenSSH调用。其他子命令可以帮助维护Gitea。
- `build`:帮助构建 Gitea 的脚本。
- `cmd`:包含所有 Gitea 的实际子命令,包括 web、doctor、serv、hooks、admin 等。`web`将启动 Web 服务。`serv``hooks`将被 GitOpenSSH 调用。其他子命令可以帮助维护 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、modulesservices不能依赖于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、modulesservices不能依赖于 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) ``
### 未来的任务

View File

@@ -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)`
@@ -42,8 +42,8 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
### 可访问性 / ARIA
在历史上Gitea大量使用了可访问性不友好的框架 Fomantic UI。
Gitea使用一些补丁使Fomantic UI更具可访问性参见`aria.js``aria.md`
在历史上Gitea 大量使用了可访问性不友好的框架 Fomantic UI。
Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见`aria.js``aria.md`
但仍然存在许多问题需要大量的工作和时间来修复。
### 框架使用
@@ -53,14 +53,14 @@ Gitea使用一些补丁使Fomantic UI更具可访问性参见`aria.js`和`ari
推荐的实现方式:
* Vue + Vanilla JS
* Fomantic-UIjQuery
* Vanilla JS
- Vue + Vanilla JS
- Fomantic-UIjQuery
- Vanilla JS
不推荐的实现方式:
* Vue + Fomantic-UIjQuery
* jQuery + Vanilla JS
- Vue + Fomantic-UIjQuery
- jQuery + Vanilla JS
为了保持界面一致Vue 组件可以使用 Fomantic-UI 的 CSS 类。
尽管不建议混合使用不同的框架,
@@ -79,7 +79,7 @@ Gitea使用一些补丁使Fomantic UI更具可访问性参见`aria.js`和`ari
如果我们想在非异步上下文中调用`async`函数,
建议使用`const _promise = asyncFoo()`来告诉读者
这是有意为之的我们想调用异步函数并忽略Promise。
这是有意为之的,我们想调用异步函数并忽略 Promise。
一些 lint 规则和 IDE 也会在未处理返回的 Promise 时发出警告。
### HTML 属性和 dataset
@@ -87,31 +87,41 @@ Gitea使用一些补丁使Fomantic UI更具可访问性参见`aria.js`和`ari
禁止使用`dataset`,它的驼峰命名行为使得搜索属性变得困难。
然而,仍然存在一些特殊情况,因此当前的准则是:
* 对于旧代码:
* 应将`$.data()`重构为`$.attr()`
* 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
- 对于旧代码:
* 对于新代码:
* 不应使用`node.dataset`,而应使用`node.getAttribute`
* 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
- 应将`$.data()`重构为`$.attr()`
- 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用
- 对于新代码:
- 不应使用`node.dataset`,而应使用`node.getAttribute`
- 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
### 显示/隐藏元素
* 推荐在Vue组件中使用`v-if``v-show`来显示/隐藏元素。
* Go 模板代码应使用 Gitea 的 `.gt-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-hidden`的注释以获取更多详细信息。
- 推荐在 Vue 组件中使用`v-if``v-show`来显示/隐藏元素。
- Go 模板代码应使用 Gitea 的 `.gt-hidden``showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-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>
```
以使代码更易读。

View File

@@ -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 天后由一名核心成员(非作者)批准后合并。
- 如果最终结果良好,容忍一些不完美/临时的步骤。
- 如果重构是必要的,容忍一些回归错误,并尽快修复错误。

View File

@@ -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 项目。

View File

@@ -8,7 +8,7 @@ aliases:
# 集成
Gitea拥有一个出色的第三方集成社区以及在其他各种项目中的一流支持。
Gitea 拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
我们正在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)上整理一个列表来跟踪这些集成!

View File

@@ -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)中找到这些接口。

View File

@@ -33,40 +33,40 @@ Gitea 支持作为 OAuth2 提供者,允许第三方应用程序在用户同意
Gitea 支持以下令牌范围:
| 名称 | 介绍 |
| ---- | ----------- |
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
| **repo** | 完全控制所有存储库 |
| &nbsp;&nbsp;&nbsp; **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **public_repo** | 仅授予对公共存储库的读/写访问权限 |
| **admin:repo_hook** | 授予对所有存储库的 Hooks 访问权限,该权限已包含在 `repo` 范围中 |
| &nbsp;&nbsp;&nbsp; **write:repo_hook** | 授予对存储库 Hooks 的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:repo_hook** | 授予对存储库 Hooks 的只读访问权限 |
| **admin:org** | 授予对组织设置的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:org** | 授予对组织设置的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:org** | 授予对组织设置的只读访问权限 |
| **admin:public_key** | 授予公钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:public_key** | 授予对公钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:public_key** | 授予对公钥的只读访问权限 |
| **admin:org_hook** | 授予对组织级别 Hooks 的完全访问权限 |
| **admin:user_hook** | 授予对用户级别 Hooks 的完全访问权限 |
| **notification** | 授予对通知的完全访问权限 |
| **user** | 授予对用户个人资料信息的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **read:user** | 授予对用户个人资料的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:email** | 授予对用户电子邮件地址的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:follow** | 授予访问权限以关注/取消关注用户 |
| **delete_repo** | 授予删除存储库的权限 |
| **package** | 授予对托管包的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:package** | 授予对包的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:package** | 授予对包的读取权限 |
| &nbsp;&nbsp;&nbsp; **delete:package** | 授予对包的删除权限 |
| **admin:gpg_key** | 授予 GPG 密钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:gpg_key** | 授予对 GPG 密钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:gpg_key** | 授予对 GPG 密钥的只读访问权限 |
| **admin:application** | 授予应用程序管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:application** | 授予应用程序管理的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:application** | 授予应用程序管理的读取权限 |
| **sudo** | 允许以站点管理员身份执行操作 |
| 名称 | 介绍 |
| ---------------------------------------- | --------------------------------------------------------------- |
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
| **repo** | 完全控制所有存储库 |
| &nbsp;&nbsp;&nbsp; **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **public_repo** | 仅授予对公共存储库的读/写访问权限 |
| **admin:repo_hook** | 授予对所有存储库的 Hooks 访问权限,该权限已包含在 `repo` 范围中 |
| &nbsp;&nbsp;&nbsp; **write:repo_hook** | 授予对存储库 Hooks 的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:repo_hook** | 授予对存储库 Hooks 的只读访问权限 |
| **admin:org** | 授予对组织设置的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:org** | 授予对组织设置的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:org** | 授予对组织设置的只读访问权限 |
| **admin:public_key** | 授予公钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:public_key** | 授予对公钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:public_key** | 授予对公钥的只读访问权限 |
| **admin:org_hook** | 授予对组织级别 Hooks 的完全访问权限 |
| **admin:user_hook** | 授予对用户级别 Hooks 的完全访问权限 |
| **notification** | 授予对通知的完全访问权限 |
| **user** | 授予对用户个人资料信息的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **read:user** | 授予对用户个人资料的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:email** | 授予对用户电子邮件地址的读取权限 |
| &nbsp;&nbsp;&nbsp; **user:follow** | 授予访问权限以关注/取消关注用户 |
| **delete_repo** | 授予删除存储库的权限 |
| **package** | 授予对托管包的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:package** | 授予对包的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:package** | 授予对包的读取权限 |
| &nbsp;&nbsp;&nbsp; **delete:package** | 授予对包的删除权限 |
| **admin:gpg_key** | 授予 GPG 密钥管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:gpg_key** | 授予对 GPG 密钥的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:gpg_key** | 授予对 GPG 密钥的只读访问权限 |
| **admin:application** | 授予应用程序管理的完全访问权限 |
| &nbsp;&nbsp;&nbsp; **write:application** | 授予应用程序管理的读/写访问权限 |
| &nbsp;&nbsp;&nbsp; **read:application** | 授予应用程序管理的读取权限 |
| **sudo** | 允许以站点管理员身份执行操作 |
## 客户端类型

View File

@@ -4,7 +4,6 @@ slug: "faq"
sidebar_position: 5
aliases:
- /zh-cn/faq
---
# 常见问题
@@ -13,128 +12,128 @@ aliases:
有关更多帮助资源,请查看所有[支持选项](seek-help.md)。
## 1.x1.x.x下载之间的区别
## 1.x1.x.x 下载之间的区别
以1.7.x版本为例。
1.7.x 版本为例。
**注意:**此示例也适用于Docker镜像
**注意:**此示例也适用于 Docker 镜像!
在我们的[下载页面](https://dl.gitea.io/gitea/)上您会看到一个1.7目录以及1.7.0、1.7.1、1.7.2、1.7.3、1.7.4、1.7.51.7.6的目录。
在我们的[下载页面](https://dl.gitea.io/gitea/)上,您会看到一个 1.7 目录,以及 1.7.0、1.7.1、1.7.2、1.7.3、1.7.4、1.7.51.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.9.146或更低](installation/upgrade-from-gogs.md)
- [Gogs版本0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
- [Gogs 版本 0.9.146 或更低](installation/upgrade-from-gogs.md)
- [Gogs 版本 0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
要从GitHub迁移到Gitea您可以使用Gitea内置的迁移表单。
要从 GitHub 迁移到 Gitea您可以使用 Gitea 内置的迁移表单。
为了迁移诸如问题、拉取请求等项目,您需要至少输入您的用户名。
[Example (requires login)](https://try.gitea.io/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.inidatabase部分的PATH
- SQLite 数据库
- app.inidatabase 部分的 PATH
- 或者`%(APP_DATA_PATH)/gitea.db`
## 看不到克隆URL或克隆URL不正确
## 看不到克隆 URL 或克隆 URL 不正确
有几个地方可能会导致显示不正确。
1. 如果使用反向代理,请确保按照[反向代理指南](../administration/reverse-proxies.md)中的正确说明进行设置。
2. 确保在`app.ini``server`部分中正确设置了`ROOT_URL`
如果某些克隆选项未显示HTTP/SSSH可以在`app.ini中`
如果某些克隆选项未显示HTTP/SSSH可以在`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`
1. 要找到`CustomPath`,请在站点管理 -> 配置 中查找自定义文件根路径。
如果找不到,请尝试`echo $GITEA_CUSTOM`
如果找不到,请尝试`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-documentation.md)
## 什么是Swagger
## 什么是 Swagger
[Swagger](https://swagger.io/) 是Gitea用于其API文档的工具。
[Swagger](https://swagger.io/) 是 Gitea 用于其 API 文档的工具。
所有Gitea实例都有内置的API无法完全禁用它。
但是您可以在app.iniapi部分将ENABLE_SWAGGER设置为false以禁用其文档显示。
有关更多信息请参阅Gitea的[API文档](development/api-usage.md)。
所有 Gitea 实例都有内置的 API无法完全禁用它。
但是,您可以在 app.iniapi 部分将 ENABLE_SWAGGER 设置为 false以禁用其文档显示。
有关更多信息,请参阅 Gitea 的[API 文档](development/api-usage.md)。
您可以在上查看最新的API例如https://try.gitea.io/api/swagger
您可以在上查看最新的 API例如https://try.gitea.io/api/swagger
您还可以在上查看`swagger.json`文件的示例 https://try.gitea.io/swagger.v1.json
@@ -145,7 +144,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 的管理界面创建新用户。
@@ -186,13 +185,13 @@ Gitea 目前支持三个官方主题,分别是 `gitea`(亮色)、`arc-gree
通过将`arc-blue`添加到`app.ini`中的`THEMES`列表中,允许用户使用该主题
## SSHD vs 内建SSH
## SSHD vs 内建 SSH
SSHD是大多数Unix系统上内建的SSH服务器。
SSHD 是大多数 Unix 系统上内建的 SSH 服务器。
Gitea还提供了自己的SSH服务器用于在SSHD不可用时使用。
Gitea 还提供了自己的 SSH 服务器,用于在 SSHD 不可用时使用。
## Gitea运行缓慢
## Gitea 运行缓慢
导致此问题的最常见原因是加载联合头像。
@@ -202,35 +201,35 @@ 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未运行
## 推送钩子/ Webhook 未运行
如果您可以推送但无法在主页仪表板上看到推送活动或者推送不触发Webhook有几种可能性
如果您可以推送但无法在主页仪表板上看到推送活动,或者推送不触发 Webhook有几种可能性
1. Git钩子不同步在站点管理面板上运行“重新同步所有仓库的pre-receive、updatepost-receive钩子”
2. Git仓库和钩子存储在一些不支持脚本执行的文件系统上例如由NAS挂载请确保文件系统支持`chmod a+x any-script`
3. 如果您使用的是Docker请确保Docker Server而不是客户端的版本 >= 20.10.6
1. Git 钩子不同步:在站点管理面板上运行“重新同步所有仓库的 pre-receive、updatepost-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 git@myremote.example`
@@ -258,16 +257,18 @@ fatal: Could not read from remote repository.
- 在客户端:
- 确保公钥和私钥已添加到正确的 Gitea 用户。
- 确保远程 URL 中没有任何问题。特别是,请确保∂
Git 用户(@ 之前的部分)的名称拼写正确。
- 确保远程 URL 中没有任何问题。特别是,请确保
Git 用户(@ 之前的部分)的名称拼写正确。
- 确保客户端机器上的公钥和私钥正确无误。
- 在服务器上:
- 确保存储库存在并且命名正确。
- 检查系统用户主目录中的 `.ssh` 目录的权限。
- 验证正确的公钥是否已添加到 `.ssh/authorized_keys` 中。
尝试在 Gitea 管理面板上运行
`Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)`
- 查看 Gitea 日志。
- 查看 /var/log/auth或类似的文件
- 检查存储库的权限。
@@ -339,7 +340,9 @@ Gitea 提供了一个子命令`gitea migrate`来初始化数据库,然后您
- 使用[管理 CLI 命令](../administration/command-line.md#admin)。
请注意,大多数命令还需要一个[全局标志](../administration/command-line.md#全局选项)来指向正确的配置。
- 作为**用户**,您可以更改密码...
- 在您的账户的`设置 -> 账户`页面(此方法**需要**您知道当前密码)。
- 使用`忘记密码`链接。
@@ -349,7 +352,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 规范,看看问题是由错误还是非兼容的语法引起的。
如果是后者,通常规范中会列出一种符合标准的替代方法。

View File

@@ -18,149 +18,149 @@ aliases:
1. 对于远程数据库设置,您需要让 MySQL 监听您的 IP 地址。编辑数据库实例上的 `/etc/mysql/my.cnf` 文件中的 `bind-address` 选项为:
```ini
bind-address = 203.0.113.3
```
```ini
bind-address = 203.0.113.3
```
2. 在数据库实例上,使用 `root` 用户登录到数据库控制台:
```
mysql -u root -p
```
```
mysql -u root -p
```
按提示输入密码。
按提示输入密码。
3. 创建一个将被 Gitea 使用的数据库用户,并使用密码进行身份验证。以下示例中使用了 `'gitea'` 作为密码。请为您的实例使用一个安全密码。
对于本地数据库:
对于本地数据库:
```sql
SET old_passwords=0;
CREATE USER 'gitea' IDENTIFIED BY 'gitea';
```
```sql
SET old_passwords=0;
CREATE USER 'gitea' IDENTIFIED BY 'gitea';
```
对于远程数据库:
对于远程数据库:
```sql
SET old_passwords=0;
CREATE USER 'gitea'@'192.0.2.10' IDENTIFIED BY 'gitea';
```
```sql
SET old_passwords=0;
CREATE USER 'gitea'@'192.0.2.10' IDENTIFIED BY 'gitea';
```
其中 `192.0.2.10` 是您的 Gitea 实例的 IP 地址。
其中 `192.0.2.10` 是您的 Gitea 实例的 IP 地址。
根据需要替换上述用户名和密码。
根据需要替换上述用户名和密码。
4. 使用 UTF-8 字符集和排序规则创建数据库。确保使用 `**utf8mb4**` 字符集,而不是 `utf8`,因为前者支持 _Basic Multilingual Plane_ 之外的所有 Unicode 字符(包括表情符号)。排序规则根据您预期的内容选择。如果不确定,可以使用 `unicode_ci` 或 `general_ci`。
```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
```
```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
```
根据需要替换数据库名称。
根据需要替换数据库名称。
5. 将数据库上的所有权限授予上述创建的数据库用户。
对于本地数据库:
对于本地数据库:
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea';
FLUSH PRIVILEGES;
```
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea';
FLUSH PRIVILEGES;
```
对于远程数据库:
对于远程数据库:
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'192.0.2.10';
FLUSH PRIVILEGES;
```
```sql
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'192.0.2.10';
FLUSH PRIVILEGES;
```
6. 通过 exit 退出数据库控制台。
7. 在您的 Gitea 服务器上,测试与数据库的连接:
```
mysql -u gitea -h 203.0.113.3 -p giteadb
```
```
mysql -u gitea -h 203.0.113.3 -p giteadb
```
其中 `gitea` 是数据库用户名,`giteadb` 是数据库名称,`203.0.113.3` 是数据库实例的 IP 地址。对于本地数据库,省略 -h 选项。
其中 `gitea` 是数据库用户名,`giteadb` 是数据库名称,`203.0.113.3` 是数据库实例的 IP 地址。对于本地数据库,省略 -h 选项。
到此您应该能够连接到数据库了。
到此您应该能够连接到数据库了。
## PostgreSQL
1. 对于远程数据库设置,通过编辑数据库实例上的 postgresql.conf 文件中的 listen_addresses 将 PostgreSQL 配置为监听您的 IP 地址:
```ini
listen_addresses = 'localhost, 203.0.113.3'
```
```ini
listen_addresses = 'localhost, 203.0.113.3'
```
2. PostgreSQL 默认使用 `md5` 质询-响应加密方案进行密码身份验证。现在这个方案不再被认为是安全的。改用 SCRAM-SHA-256 方案,通过编辑数据库服务器上的` postgresql.conf` 配置文件:
```ini
password_encryption = scram-sha-256
```
```ini
password_encryption = scram-sha-256
```
重启 PostgreSQL 以应用该设置。
重启 PostgreSQL 以应用该设置。
3. 在数据库服务器上,以超级用户身份登录到数据库控制台:
```
su -c "psql" - postgres
```
```
su -c "psql" - postgres
```
4. 创建具有登录权限和密码的数据库用户(在 PostgreSQL 术语中称为角色)。请使用安全的、强密码,而不是下面的 `'gitea'`
```sql
CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea';
```
```sql
CREATE ROLE gitea WITH LOGIN PASSWORD 'gitea';
```
根据需要替换用户名和密码。
根据需要替换用户名和密码。
5. 使用 UTF-8 字符集创建数据库,并由之前创建的数据库用户拥有。可以根据预期内容使用任何 `libc` 排序规则,使用 `LC_COLLATE` 和 `LC_CTYPE` 参数指定:
```sql
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
```
```sql
CREATE DATABASE giteadb WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
```
根据需要替换数据库名称。
根据需要替换数据库名称。
6. 通过将以下身份验证规则添加到 `pg_hba.conf`,允许数据库用户访问上面创建的数据库。
对于本地数据库:
对于本地数据库:
```ini
local giteadb gitea scram-sha-256
```
```ini
local giteadb gitea scram-sha-256
```
对于远程数据库:
对于远程数据库:
```ini
host giteadb gitea 192.0.2.10/32 scram-sha-256
```
```ini
host giteadb gitea 192.0.2.10/32 scram-sha-256
```
根据您自己的数据库名称、用户和 Gitea 实例的 IP 地址进行替换。
根据您自己的数据库名称、用户和 Gitea 实例的 IP 地址进行替换。
注意:`pg_hba.conf` 上的规则按顺序评估,也就是第一个匹配的规则将用于身份验证。您的 PostgreSQL 安装可能附带了适用于所有用户和数据库的通用身份验证规则。如果是这种情况,您可能需要将此处提供的规则放置在此类通用规则之上。
注意:`pg_hba.conf` 上的规则按顺序评估,也就是第一个匹配的规则将用于身份验证。您的 PostgreSQL 安装可能附带了适用于所有用户和数据库的通用身份验证规则。如果是这种情况,您可能需要将此处提供的规则放置在此类通用规则之上。
重启 PostgreSQL 以应用新的身份验证规则。
重启 PostgreSQL 以应用新的身份验证规则。
7. 在您的 Gitea 服务器上,测试与数据库的连接。
对于本地数据库:
对于本地数据库:
```
psql -U gitea -d giteadb
```
```
psql -U gitea -d giteadb
```
对于远程数据库:
对于远程数据库:
```
psql "postgres://gitea@203.0.113.3/giteadb"
```
```
psql "postgres://gitea@203.0.113.3/giteadb"
```
其中 `gitea` 是数据库用户,`giteadb` 是数据库名称,`203.0.113.3` 是您的数据库实例的 IP 地址。
其中 `gitea` 是数据库用户,`giteadb` 是数据库名称,`203.0.113.3` 是您的数据库实例的 IP 地址。
您应该会被提示输入数据库用户的密码,并连接到数据库。
您应该会被提示输入数据库用户的密码,并连接到数据库。
## 使用 TLS 进行数据库连接
@@ -179,116 +179,116 @@ Gitea 使用的 PostgreSQL 驱动程序支持双向 TLS。在双向 TLS 中,
1. 在数据库实例所在的服务器上,放置以下凭据:
- `/path/to/postgresql.crt`: 数据库实例证书
- `/path/to/postgresql.key`: 数据库实例私钥
- `/path/to/root.crt`: 用于验证客户端证书的CA证书链
- `/path/to/postgresql.crt`: 数据库实例证书
- `/path/to/postgresql.key`: 数据库实例私钥
- `/path/to/root.crt`: 用于验证客户端证书的 CA 证书链
2. 在 `postgresql.conf` 中添加以下选项:
```ini
ssl = on
ssl_ca_file = '/path/to/root.crt'
ssl_cert_file = '/path/to/postgresql.crt'
ssl_key_file = '/path/to/postgresql.key'
ssl_min_protocol_version = 'TLSv1.2'
```
```ini
ssl = on
ssl_ca_file = '/path/to/root.crt'
ssl_cert_file = '/path/to/postgresql.crt'
ssl_key_file = '/path/to/postgresql.key'
ssl_min_protocol_version = 'TLSv1.2'
```
3. 根据 PostgreSQL 的要求,调整凭据的所有权和权限:
```
chown postgres:postgres /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
chmod 0600 /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
```
```
chown postgres:postgres /path/to/root.crt /path/to/postgresql.crt /path/to/postgresql.key
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
```
```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
```
```ini
hostssl giteadb gitea 192.0.2.10/32 scram-sha-256 clientcert=1
```
根据需要替换数据库名称、用户和 Gitea 实例的 IP 地址。
根据需要替换数据库名称、用户和 Gitea 实例的 IP 地址。
5. 重新启动 PostgreSQL 以应用上述配置。
6. 在运行 Gitea 实例的服务器上,将以下凭据放置在运行 Gitea 的用户的主目录下(例如 `git`
- `~/.postgresql/postgresql.crt`: 数据库客户端证书
- `~/.postgresql/postgresql.key`: 数据库客户端私钥
- `~/.postgresql/root.crt`: 用于验证服务器证书的CA证书链
- `~/.postgresql/postgresql.crt`: 数据库客户端证书
- `~/.postgresql/postgresql.key`: 数据库客户端私钥
- `~/.postgresql/root.crt`: 用于验证服务器证书的 CA 证书链
注意:上述文件名在 PostgreSQL 中是硬编码的,无法更改。
注意:上述文件名在 PostgreSQL 中是硬编码的,无法更改。
7. 根据需要调整凭据、所有权和权限:
```
chown git:git ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
chown 0600 ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
```
```
chown git:git ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
chown 0600 ~/.postgresql/postgresql.crt ~/.postgresql/postgresql.key ~/.postgresql/root.crt
```
8. 测试与数据库的连接:
```
psql "postgres://gitea@example.db/giteadb?sslmode=verify-full"
```
```
psql "postgres://gitea@example.db/giteadb?sslmode=verify-full"
```
您将被提示输入数据库用户的密码,然后连接到数据库。
您将被提示输入数据库用户的密码,然后连接到数据库。
### MySQL
虽然 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/mysql.crt`: 数据库实例证书
- `/path/to/mysql.key`: 数据库实例密钥
- `/path/to/ca.crt`: CA 证书链。在单向 TLS 中不使用此文件,但用于验证双向 TLS 中的客户端证书。
2. 将以下选项添加到 `my.cnf`
```ini
[mysqld]
ssl-ca = /path/to/ca.crt
ssl-cert = /path/to/mysql.crt
ssl-key = /path/to/mysql.key
tls-version = TLSv1.2,TLSv1.3
```
```ini
[mysqld]
ssl-ca = /path/to/ca.crt
ssl-cert = /path/to/mysql.crt
ssl-key = /path/to/mysql.key
tls-version = TLSv1.2,TLSv1.3
```
3. 调整凭据的所有权和权限:
```
chown mysql:mysql /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
chmod 0600 /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
```
```
chown mysql:mysql /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
chmod 0600 /path/to/ca.crt /path/to/mysql.crt /path/to/mysql.key
```
4. 重新启动MySQL以应用设置。
4. 重新启动 MySQL 以应用设置。
5. Gitea 的数据库用户可能已经创建过,但只会对运行 Gitea 的服务器的 IP 地址进行身份验证。要对其域名进行身份验证,请重新创建用户,并设置其需要通过 TLS 连接到数据库:
```sql
DROP USER 'gitea'@'192.0.2.10';
CREATE USER 'gitea'@'example.gitea' IDENTIFIED BY 'gitea' REQUIRE SSL;
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'example.gitea';
FLUSH PRIVILEGES;
```
```sql
DROP USER 'gitea'@'192.0.2.10';
CREATE USER 'gitea'@'example.gitea' IDENTIFIED BY 'gitea' REQUIRE SSL;
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'example.gitea';
FLUSH PRIVILEGES;
```
根据需要替换数据库用户名、密码和 Gitea 实例域名。
根据需要替换数据库用户名、密码和 Gitea 实例域名。
6. 确保用于验证数据库服务器证书的CA证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
6. 确保用于验证数据库服务器证书的 CA 证书链位于数据库和 Gitea 服务器的系统证书存储中。请参考系统文档中有关将 CA 证书添加到证书存储的说明。
7. 在运行Gitea的服务器上测试与数据库的连接
7. 在运行 Gitea 的服务器上,测试与数据库的连接:
```
mysql -u gitea -h example.db -p --ssl
```
```
mysql -u gitea -h example.db -p --ssl
```
至此应该成功连接到数据库了。
至此应该成功连接到数据库了。

View File

@@ -37,7 +37,7 @@ Gitea 对打包的二进制文件使用 [GPG密钥](https://keys.openpgp.org/sea
请根据对应文件名 `.asc` 中包含的校验码检验文件的一致性。
```sh
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-@version@-linux-amd64.asc gitea-@version@-linux-amd64
```

View File

@@ -6,13 +6,13 @@ sidebar_position: 30
# 使用源代码安装
首先你需要安装Golang关于Golang的安装参见[官方文档](https://golang.google.cn/doc/install)。
首先你需要安装 Golang关于 Golang 的安装,参见[官方文档](https://golang.google.cn/doc/install)。
其次你需要[安装Node.js](https://nodejs.org/zh-cn/download/)Node.js 和 npm 将用于构建 Gitea 前端。
其次你需要[安装 Node.js](https://nodejs.org/zh-cn/download/)Node.js 和 npm 将用于构建 Gitea 前端。
## 下载
你需要获取Gitea的源码最方便的方式是使用 `git` 命令。执行以下命令:
你需要获取 Gitea 的源码,最方便的方式是使用 `git` 命令。执行以下命令:
```
git clone https://github.com/go-gitea/gitea
@@ -48,8 +48,8 @@ git checkout @sourceVersion@
按照您的编译需求,以下 tags 可以使用:
- `bindata`: 这个编译选项将会把运行Gitea所需的所有外部资源都打包到可执行文件中这样部署将非常简单因为除了可执行程序将不再需要任何其他文件。
- `sqlite sqlite_unlock_notify`: 这个编译选项将启用SQLite3数据库的支持建议只在少数人使用时使用这个模式。
- `bindata`: 这个编译选项将会把运行 Gitea 所需的所有外部资源都打包到可执行文件中,这样部署将非常简单因为除了可执行程序将不再需要任何其他文件。
- `sqlite sqlite_unlock_notify`: 这个编译选项将启用 SQLite3 数据库的支持,建议只在少数人使用时使用这个模式。
- `pam`: 这个编译选项将会启用 PAM (Linux Pluggable Authentication Modules) 认证,如果你使用这一认证模式的话需要开启这个选项。
使用 bindata 可以打包资源文件到二进制可以使开发和测试更容易,你可以根据自己的需求决定是否打包资源文件。

View File

@@ -15,9 +15,9 @@ Cloudron 使得在您的服务器上运行 Gitea并保持其更新和安全
[![Install](/cloudron.svg)](https://cloudron.io/button.html?app=io.gitea.cloudronapp)
Gitea软件包的维护地址在[这里](https://git.cloudron.io/cloudron/gitea-app).
Gitea 软件包的维护地址在[这里](https://git.cloudron.io/cloudron/gitea-app).
这里有一个[demo 实例](https://my.demo.cloudron.io) (用户名: cloudron 密码: cloudron) 您可以在其中尝试运行Gitea。
这里有一个[demo 实例](https://my.demo.cloudron.io) (用户名: cloudron 密码: cloudron) 您可以在其中尝试运行 Gitea。
## Linode

View File

@@ -33,15 +33,15 @@ helm install gitea -f values.yaml gitea/gitea
Gitea 附带了一个运行状况检查接口 `/api/healthz`,你可以像这样在 Kubernetes 中配置它:
```yaml
livenessProbe:
httpGet:
path: /api/healthz
port: http
initialDelaySeconds: 200
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
livenessProbe:
httpGet:
path: /api/healthz
port: http
initialDelaySeconds: 200
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
```
成功的运行状况检查响应代码为 HTTP `200`,下面是示例:

View File

@@ -16,7 +16,7 @@ rootless 镜像使用 Gitea 内部 SSH 功能来提供 Git 协议,但不支持
## 基础设置
最简单的设置只需创建一个卷和一个网络,并将 `gitea/gitea:latest-rootless` 镜像作为服务启动。由于没有可用的数据库,可以使用 SQLite3 来初始化一个。
最简单的设置只需创建一个卷和一个网络,并将 `docker.gitea.com/gitea:latest-rootless` 镜像作为服务启动。由于没有可用的数据库,可以使用 SQLite3 来初始化一个。
创建一个名为 `data``config`:
@@ -33,7 +33,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
@@ -45,7 +45,7 @@ services:
- "2222:2222"
```
请注意卷应由在配置文件中指定的UID/GID的用户/组所有。默认情况下Docker中的Gitea将使用uid:1000 gid:1000。如果需要您可以使用以下命令设置这些文件夹的所有权
请注意,卷应由在配置文件中指定的 UID/GID 的用户/组所有。默认情况下Docker 中的 Gitea 将使用 uid:1000 gid:1000。如果需要您可以使用以下命令设置这些文件夹的所有权
```sh
sudo chown 1000:1000 config/ data/
@@ -53,18 +53,18 @@ sudo chown 1000:1000 config/ data/
> 如果未为卷设置正确的权限,容器可能无法启动。
对于稳定版本,您可以使用 `:latest-rootless``:1-rootless`,或指定特定的版本,如: `@dockerVersion@-rootless`。如果您想使用最新的开发版本,则可以使用 `:dev-rootless` 标签。如果您想运行发布分支的最新提交,可以使用 `:1.x-dev-rootless` 标签,其中 x是 Gitea 的次要版本号(例如:`1.16-dev-rootless`)。
对于稳定版本,您可以使用 `:latest-rootless``:1-rootless`,或指定特定的版本,如: `@dockerVersion@-rootless`。如果您想使用最新的开发版本,则可以使用 `:dev-rootless` 标签。如果您想运行发布分支的最新提交,可以使用 `:1.x-dev-rootless` 标签,其中 x 是 Gitea 的次要版本号(例如:`1.16-dev-rootless`)。
## 自定义端口
要将集成的SSHWeb服务器绑定到不同的端口请调整端口部分。通常只需更改主机端口并保持容器内的端口不变。
要将集成的 SSHWeb 服务器绑定到不同的端口,请调整端口部分。通常只需更改主机端口并保持容器内的端口不变。
```diff
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
@@ -87,7 +87,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
@@ -127,7 +127,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
@@ -172,7 +172,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
@@ -199,7 +199,7 @@ version: "2"
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@-rootless
image: docker.gitea.com/gitea:@dockerVersion@-rootless
restart: always
+ user: 1001
volumes:
@@ -252,13 +252,13 @@ docker-compose up -d
- 将卷中的文件夹gitea重命名为 custom
- 如果需要,编辑 `app.ini`
- 设置 `START_SSH_SERVER = true`
- 使用镜像 ` docker.io/gitea/gitea:@dockerVersion@-rootless`
- 使用镜像 ` docker.gitea.com/gitea:@dockerVersion@-rootless`
## 使用环境变量管理部署
除了上述的环境变量外,`app.ini` 中的任何设置都可以通过形式为 `GITEA__SECTION_NAME__KEY_NAME` 的环境变量进行设置或覆盖。这些设置在每次 Docker 容器启动时都会生效。完整信息请参考[这里](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini).
这些环境变量可以在 `docker-compose.yml` 中传递给 Docker 容器。以下示例将启用 SMTP 邮件服务器,如果主机上设置了所需的环境变量 GITEA__mailer__FROM、GITEA__mailer__HOST、GITEA__mailer__PASSWD或者在与 `docker-compose.yml` 相同目录中的 `.env` 文件中设置了这些环境变量:
这些环境变量可以在 `docker-compose.yml` 中传递给 Docker 容器。以下示例将启用 SMTP 邮件服务器,如果主机上设置了所需的环境变量 GITEA**mailer**FROM、GITEA**mailer**HOST、GITEA**mailer**PASSWD或者在与 `docker-compose.yml` 相同目录中的 `.env` 文件中设置了这些环境变量:
```bash
...

View File

@@ -12,7 +12,7 @@ Gitea 在其 Docker Hub 组织内提供自动更新的 Docker 镜像。可以始
## 基本
最简单的设置只是创建一个卷和一个网络,然后将 `gitea/gitea:latest` 镜像作为服务启动。由于没有可用的数据库,因此可以使用 SQLite3 初始化数据库。创建一个类似 `gitea` 的目录,并将以下内容粘贴到名为 `docker-compose.yml` 的文件中。请注意,该卷应由配置文件中指定的 UID/GID 的用户/组拥有。如果您不授予卷正确的权限,则容器可能无法启动。另请注意,标签 `:latest` 将安装当前的开发版本。对于稳定的发行版,您可以使用 `:1` 或指定某个发行版,例如 `@dockerVersion@`
最简单的设置只是创建一个卷和一个网络,然后将 `docker.gitea.com/gitea:latest` 镜像作为服务启动。由于没有可用的数据库,因此可以使用 SQLite3 初始化数据库。创建一个类似 `gitea` 的目录,并将以下内容粘贴到名为 `docker-compose.yml` 的文件中。请注意,该卷应由配置文件中指定的 UID/GID 的用户/组拥有。如果您不授予卷正确的权限,则容器可能无法启动。另请注意,标签 `:latest` 将安装当前的开发版本。对于稳定的发行版,您可以使用 `:1` 或指定某个发行版,例如 `@dockerVersion@`
```yaml
version: "3"
@@ -23,7 +23,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -53,7 +53,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -87,7 +87,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -137,7 +137,7 @@ networks:
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
environment:
- USER_UID=1000
@@ -190,7 +190,7 @@ networks:
+
services:
server:
image: docker.io/gitea/gitea:@dockerVersion@
image: docker.gitea.com/gitea:@dockerVersion@
container_name: gitea
restart: always
networks:
@@ -290,12 +290,12 @@ Gitea 将为每次新安装自动生成新的 `SECRET_KEY` 并将它们写入 `a
以下命令将向 `stdout` 输出一个新的 `SECRET_KEY``INTERNAL_TOKEN`,然后您可以将其放入环境变量中。
```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
...
---
services:
server:
environment:
@@ -342,7 +342,7 @@ ports:
- "127.0.0.1:2222:22"
```
另外,主机上的 `/home/git/.ssh/authorized_keys` 需要修改。它需要以与 Gitea 容器内的 `authorized_keys` 相同的方式进行操作。因此将您在上面创建的密钥“Gitea 主机密钥”)的公共密钥添加到 `~/git/.ssh/authorized_keys`。这可以通过 `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys` 完成。重要提示:来自 `git` 用户的公钥需要“按原样”添加,而通过 Gitea 网络界面添加的所有其他公钥将以 `command="/app [...]` 作为前缀。
另外,主机上的 `/home/git/.ssh/authorized_keys` 需要修改。它需要以与 Gitea 容器内的 `authorized_keys` 相同的方式进行操作。因此将您在上面创建的密钥“Gitea 主机密钥”)的公共密钥添加到 `/home/git/.ssh/authorized_keys`。这可以通过 `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys` 完成。重要提示:来自 `git` 用户的公钥需要“按原样”添加,而通过 Gitea 网络界面添加的所有其他公钥将以 `command="/app [...]` 作为前缀。
该文件应该看起来像:

View File

@@ -90,11 +90,11 @@ aliases:
- `m` - 分钟
- `h` - 小时
- `d` - 天(相当于8小时)
- `w` - 周(相当于5天)
- `mo` - 月(相当于4周)
- `d` - 天(相当于 8 小时)
- `w` - 周(相当于 5 天)
- `mo` - 月(相当于 4 周)
用于指定时间的数字(`<number>`)也可以是小数,例如 `@1.5h` 表示一小时半。多个时间单位可以结合使用,例如 `@1h10m` 表示1小时10分钟。
用于指定时间的数字(`<number>`)也可以是小数,例如 `@1.5h` 表示一小时半。多个时间单位可以结合使用,例如 `@1h10m` 表示 1 小时 10 分钟。
提交消息示例:
@@ -115,26 +115,26 @@ Gitea 支持使用外部工单跟踪器,并可以在合并请求中创建对
下表说明了工单和合并请求的不同类型的交叉引用。在示例中,`User1/Repo1` 指的是使用引用的仓库,而 `UserZ/RepoZ` 表示另一个仓库。
| 在 User1/Repo1 中的引用 | Repo1 的工单是外部的 | RepoZ 的工单是外部的 | 渲染效果 |
| ----------------------- | :-------------------: | :-------------------: | ------------------------------------------------ |
| `#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `UserZ/RepoZ#1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ!1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ#1234` | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ 1234 |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ`_PR_ 1234 |
| **字母数字工单编号:** | - | - | - |
| `AAA-1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ `AAA-1234` |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| _不支持_ | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ `AAA-1234` |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ` 中的 _PR_ 1234 |
| 在 User1/Repo1 中的引用 | Repo1 的工单是外部的 | RepoZ 的工单是外部的 | 渲染效果 |
| ----------------------- | :------------------: | :------------------: | --------------------------------------------- |
| `#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1#1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1!1234` | 否 | - | 链接到 `User1/Repo1` 中的工单/合并请求 1234 |
| `User1/Repo1#1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `UserZ/RepoZ#1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ!1234` | - | 否 | 链接到 `UserZ/RepoZ` 中的工单/合并请求 1234 |
| `UserZ/RepoZ#1234` | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ 1234 |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ`_PR_ 1234 |
| **字母数字工单编号:** | - | - | - |
| `AAA-1234` | 是 | - | 链接到 `User1/Repo1`_外部工单_ `AAA-1234` |
| `!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| `User1/Repo1!1234` | 是 | - | 链接到 `User1/Repo1`_PR_ 1234 |
| _不支持_ | - | 是 | 链接到 `UserZ/RepoZ`_外部工单_ `AAA-1234` |
| `UserZ/RepoZ!1234` | - | 是 | 链接到 `UserZ/RepoZ` 中的 _PR_ 1234 |
_最后一部分适用于使用字母数字格式的外部工单跟踪器的仓库。_

View File

@@ -14,31 +14,31 @@ Gitea 支持对仓库进行权限管理,这样您就可以为不同的人员
在 Gitea 中,我们将仓库的子模块称为 `单元Unit`。现在我们有以下几个单元。
| 名称 | 描述 | 权限 |
| ----------------- | --------------------------------------------------- | ------------ |
| 代码 | 访问源代码、文件、提交和分支。 | 读取 写入 |
| 工单 | 组织缺陷报告、任务和里程碑。 | 读取 写入 |
| 合并请求 | 启用合并请求和代码审核。 | 读取 写入 |
| 发布 | 跟踪项目版本和下载。 | 读取 写入 |
| 维基 | 与协作者编写和共享文档。 | 读取 写入 |
| 外部维基 | 链接到外部维基。 | 读取 |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | 读取 |
| 项目 | 模板仓库的 URL。 | 读取 写入 |
| 设置 | 管理仓库。 | 管理员 |
| 名称 | 描述 | 权限 |
| -------------- | ------------------------------ | --------- |
| 代码 | 访问源代码、文件、提交和分支。 | 读取 写入 |
| 工单 | 组织缺陷报告、任务和里程碑。 | 读取 写入 |
| 合并请求 | 启用合并请求和代码审核。 | 读取 写入 |
| 发布 | 跟踪项目版本和下载。 | 读取 写入 |
| 维基 | 与协作者编写和共享文档。 | 读取 写入 |
| 外部维基 | 链接到外部维基。 | 读取 |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | 读取 |
| 项目 | 模板仓库的 URL。 | 读取 写入 |
| 设置 | 管理仓库。 | 管理员 |
通过不同的权限,用户可以在这些单元上执行不同的操作。
| 名称 | 读取 | 写入 | 管理员 |
| ----------------- | -------------------------------------------------- | ------------------------------ | ------------------------- |
| 代码 | 查看代码树、文件、提交、分支等。 | 推送代码。 | - |
| 工单 | 查看工单并创建新工单。 | 添加标签、分配、关闭工单。 | - |
| 合并请求 | 查看合并请求并创建新合并请求。 | 添加标签、分配、关闭合并请求。 | - |
| 发布 | 查看发布和下载文件。 | 创建/编辑发布。 | - |
| 维基 | 查看维基页面。克隆维基仓库。 | 创建/编辑维基页面,推送更改。 | - |
| 外部维基 | 链接到外部维基。 | - | - |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | - | - |
| 项目 | 查看面板。 | 在面板之间移动工单。 | - |
| 设置 | - | - | 管理仓库 |
| 名称 | 读取 | 写入 | 管理员 |
| -------------- | -------------------------------- | ------------------------------ | -------- |
| 代码 | 查看代码树、文件、提交、分支等。 | 推送代码。 | - |
| 工单 | 查看工单并创建新工单。 | 添加标签、分配、关闭工单。 | - |
| 合并请求 | 查看合并请求并创建新合并请求。 | 添加标签、分配、关闭合并请求。 | - |
| 发布 | 查看发布和下载文件。 | 创建/编辑发布。 | - |
| 维基 | 查看维基页面。克隆维基仓库。 | 创建/编辑维基页面,推送更改。 | - |
| 外部维基 | 链接到外部维基。 | - | - |
| 外部工单跟踪器 | 链接到外部工单跟踪器。 | - | - |
| 项目 | 查看面板。 | 在面板之间移动工单。 | - |
| 设置 | - | - | 管理仓库 |
个人仓库和组织仓库之间的权限存在一些差异。

View File

@@ -25,17 +25,17 @@ aliases:
示例:
| 类型 | 模式受保护的标签 | 可能匹配的标签 |
| 类型 | 模式受保护的标签 | 可能匹配的标签 |
| ----- | ------------------------ | --------------------------------------- |
| Glob | `v*` | `v``v-1``version2` |
| Glob | `v[0-9]` | `v0``v1``v9` |
| Glob | `v[0-9]` | `v0``v1``v9` |
| Glob | `*-release` | `2.1-release``final-release` |
| Glob | `gitea` | 仅限 `gitea` |
| Glob | `*gitea*` | `gitea``2.1-gitea``1_gitea-release` |
| Glob | `{v,rel}-*` | `v-``v-1``v-final``rel-``rel-x` |
| Glob | `*` | 匹配所有可能的标签名称 |
| Glob | `*` | 匹配所有可能的标签名称 |
| Regex | `/\Av/` | `v``v-1``version2` |
| Regex | `/\Av[0-9]\z/` | `v0``v1``v9` |
| Regex | `/\Av[0-9]\z/` | `v0``v1``v9` |
| Regex | `/\Av\d+\.\d+\.\d+\z/` | `v1.0.17``v2.1.0` |
| Regex | `/\Av\d+(\.\d+){0,2}\z/` | `v1``v2.1``v1.2.34` |
| Regex | `/-release\z/` | `2.1-release``final-release` |
@@ -43,4 +43,4 @@ aliases:
| Regex | `/\Agitea\z/` | 仅限 `gitea` |
| Regex | `/^gitea$/` | 仅限 `gitea` |
| Regex | `/\A(v\|rel)-/` | `v-``v-1``v-final``rel-``rel-x` |
| Regex | `/.+/` | 匹配所有可能的标签名称 |
| Regex | `/.+/` | 匹配所有可能的标签名称 |

View File

@@ -53,7 +53,7 @@ aliases:
要从 Gitea 设置镜像到 GitHub您需要按照以下步骤进行操作
1. 创建一个具有选中 *public_repo* 选项的 [GitHub 个人访问令牌](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)。
1. 创建一个具有选中 _public_repo_ 选项的 [GitHub 个人访问令牌](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)。
2. 在 GitHub 上创建一个同名的仓库。与 Gitea 不同GitHub 不支持通过推送到远程来创建仓库。如果您的现有远程仓库与您的 Gitea 仓库具有相同的提交历史,您也可以使用现有的远程仓库。
3. 在您的 Gitea 仓库设置中,填写**Git 远程仓库 URL**`https://github.com/<your_github_group>/<your_github_project>.git`
4. 使用您的 GitHub 用户名填写**授权**字段,并将个人访问令牌作为**密码**。
@@ -66,7 +66,7 @@ aliases:
要从 Gitea 设置镜像到 GitLab您需要按照以下步骤进行操作
1. 创建具有 *write_repository* 作用域的 [GitLab 个人访问令牌](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)。
1. 创建具有 _write_repository_ 作用域的 [GitLab 个人访问令牌](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)。
2. 填写**Git 远程仓库 URL**`https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git`
3. 在**授权**字段中填写 `oauth2` 作为**用户名**,并将您的 GitLab 个人访问令牌作为**密码**。
4. 选择**添加推送镜像**以保存配置。
@@ -77,7 +77,7 @@ aliases:
要从 Gitea 设置镜像到 Bitbucket您需要按照以下步骤进行操作
1. 创建一个具有选中 *Repository Write* 选项的 [Bitbucket 应用密码](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)。
1. 创建一个具有选中 _Repository Write_ 选项的 [Bitbucket 应用密码](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/)。
2. 填写**Git 远程仓库 URL**`https://bitbucket.org/<your_bitbucket_group_or_name>/<your_bitbucket_project>.git`
3. 使用您的 Bitbucket 用户名填写**授权**字段,并将应用密码作为**密码**。
4. 选择**添加推送镜像**以保存配置。

View File

@@ -40,20 +40,20 @@ a/b/c/d.json
所有变量都必须采用`$VAR``${VAR}`的形式。要转义扩展,使用双重`$$`,例如`$$VAR``$${VAR}`
| 变量 | 扩展为 | 可转换 |
| -------------------- | --------------------------------------------------- | ------------- |
| REPO_NAME | 生成的仓库名称 | ✓ |
| TEMPLATE_NAME | 模板仓库名称 | ✓ |
| REPO_DESCRIPTION | 生成的仓库描述 | ✘ |
| TEMPLATE_DESCRIPTION | 模板仓库描述 | ✘ |
| REPO_OWNER | 生成的仓库所有者 | ✓ |
| TEMPLATE_OWNER | 模板仓库所有者 | ✓ |
| REPO_LINK | 生成的仓库链接 | ✘ |
| TEMPLATE_LINK | 模板仓库链接 | ✘ |
| REPO_HTTPS_URL | 生成的仓库的 HTTP(S) 克隆链接 | ✘ |
| TEMPLATE_HTTPS_URL | 模板仓库的 HTTP(S) 克隆链接 | ✘ |
| REPO_SSH_URL | 生成的仓库的 SSH 克隆链接 | ✘ |
| TEMPLATE_SSH_URL | 模板仓库的 SSH 克隆链接 | ✘ |
| 变量 | 扩展为 | 可转换 |
| -------------------- | ----------------------------- | ------ |
| REPO_NAME | 生成的仓库名称 | ✓ |
| TEMPLATE_NAME | 模板仓库名称 | ✓ |
| REPO_DESCRIPTION | 生成的仓库描述 | ✘ |
| TEMPLATE_DESCRIPTION | 模板仓库描述 | ✘ |
| REPO_OWNER | 生成的仓库所有者 | ✓ |
| TEMPLATE_OWNER | 模板仓库所有者 | ✓ |
| REPO_LINK | 生成的仓库链接 | ✘ |
| TEMPLATE_LINK | 模板仓库链接 | ✘ |
| REPO_HTTPS_URL | 生成的仓库的 HTTP(S) 克隆链接 | ✘ |
| TEMPLATE_HTTPS_URL | 模板仓库的 HTTP(S) 克隆链接 | ✘ |
| REPO_SSH_URL | 生成的仓库的 SSH 克隆链接 | ✘ |
| TEMPLATE_SSH_URL | 模板仓库的 SSH 克隆链接 | ✘ |
## 转换器 :robot:
@@ -63,12 +63,12 @@ Gitea `1.12.0` 添加了一些转换器以应用于上述适用的变量。
`go-sdk` 传递给可用的转换器的效果如下...
| 转换器 | 效果 |
| ----------- | ------------ |
| SNAKE | go_sdk |
| KEBAB | go-sdk |
| CAMEL | goSdk |
| PASCAL | GoSdk |
| LOWER | go-sdk |
| UPPER | GO-SDK |
| TITLE | Go-Sdk |
| 转换器 | 效果 |
| ------ | ------ |
| SNAKE | go_sdk |
| KEBAB | go-sdk |
| CAMEL | goSdk |
| PASCAL | GoSdk |
| LOWER | go-sdk |
| UPPER | GO-SDK |
| TITLE | Go-Sdk |

Some files were not shown because too many files have changed in this diff Show More