mirror of
https://gitea.com/gitea/docs.git
synced 2026-11-15 22:33:45 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5eac4f23d | ||
|
|
f954c6e7b8 | ||
|
|
cf9b8dce28 | ||
|
|
12293b604e | ||
|
|
bb7b7fe5bf | ||
|
|
b6af199508 | ||
|
|
dedfbf1f27 | ||
|
|
f9ff323873 | ||
|
|
1046625638 | ||
|
|
200479a1a3 | ||
|
|
bd38456e4b | ||
|
|
3578007c38 | ||
|
|
c586a396b8 | ||
|
|
de6d4374b0 | ||
|
|
c9bf137a23 | ||
|
|
83da675c59 | ||
|
|
135f34d09a | ||
|
|
3eda094305 | ||
|
|
312cbc2a6e | ||
|
|
4164f4df06 | ||
|
|
cb462089e9 | ||
|
|
908a27589d | ||
|
|
6b64b97e3b | ||
|
|
90ab1c20c2 | ||
|
|
d61eaecbb1 | ||
|
|
b30993162c | ||
|
|
004bebe6b4 | ||
|
|
ed59125e25 | ||
|
|
c699d12a55 | ||
|
|
4d5fd1f6fb | ||
|
|
c13d82ccc3 | ||
|
|
0552f4523c | ||
|
|
03c98878cf | ||
|
|
cf33eee47f | ||
|
|
201f0f3ef8 | ||
|
|
e8a6c4281d | ||
|
|
641977c93a | ||
|
|
fbd73fd263 | ||
|
|
a6fc8044b0 | ||
|
|
fa11851d67 | ||
|
|
f9ff184ee3 | ||
|
|
cbbf31f1d5 | ||
|
|
47594bba97 | ||
|
|
63c75a97c6 | ||
|
|
50aad0431b | ||
|
|
164f1c837f | ||
|
|
870f30e886 | ||
|
|
33ec7a49df | ||
|
|
bc606bd422 | ||
|
|
3a82ab51f3 | ||
|
|
c8ebd4e896 | ||
|
|
a320f53087 | ||
|
|
95544e7847 | ||
|
|
af373024a0 | ||
|
|
57ed041528 | ||
|
|
43ad642ef2 | ||
|
|
753dbfb4aa | ||
|
|
5d9094adb0 | ||
|
|
7ec1b19826 | ||
|
|
f58dfff5e4 | ||
|
|
5bf02bcd9c | ||
|
|
e1ed1a6280 | ||
|
|
6e63ddb901 | ||
|
|
e1500d23c7 | ||
|
|
2a39f74205 | ||
|
|
1d51bc6814 | ||
|
|
eed3454a8a | ||
|
|
14d48e6834 | ||
|
|
c299483551 | ||
|
|
f29075ebeb | ||
|
|
df3f3f8dab | ||
|
|
1a85ffdab8 | ||
|
|
ac2186b6fb | ||
|
|
b2b64a0401 | ||
|
|
d5945b5091 | ||
|
|
cc53afc60e | ||
|
|
330f8b808b | ||
|
|
a6305438b9 | ||
|
|
ae186bfdcc | ||
|
|
718d024fe9 | ||
|
|
e3d58503ca | ||
|
|
802aeb1e0c | ||
|
|
abc5be48cc | ||
|
|
ac801c4790 | ||
|
|
dbfa0ba454 | ||
|
|
3275094871 | ||
|
|
10e315d235 | ||
|
|
bec3fc4398 | ||
|
|
10c3198134 | ||
|
|
aedc957200 | ||
|
|
d432fb57ac | ||
|
|
2757101442 | ||
|
|
ba60733fd9 | ||
|
|
8d3a6af0de | ||
|
|
3c69e687b4 | ||
|
|
4809b3d4c8 | ||
|
|
714b9dd6b7 | ||
|
|
1a8c4f0836 | ||
|
|
2b1f9ff532 | ||
|
|
a64bf5f8e3 | ||
|
|
4cacad97aa | ||
|
|
3f023b3b62 | ||
|
|
8c7577a67c | ||
|
|
41bc13f04f | ||
|
|
eaeb29f827 | ||
|
|
003bc73398 | ||
|
|
52933671d8 | ||
|
|
045ad3fd8c | ||
|
|
540072fa39 | ||
|
|
ed742f54da | ||
|
|
235e1199d8 | ||
|
|
674911fecd | ||
|
|
bc2618cea3 | ||
|
|
88ff15b0f5 | ||
|
|
04b38c7f3a | ||
|
|
bb149ae308 | ||
|
|
a7d3ff1ea1 | ||
|
|
eb0c2f7ccc | ||
|
|
452b13ec63 | ||
|
|
cea3a053b7 | ||
|
|
93d5d77bfd | ||
|
|
6ebfe37c28 | ||
|
|
bbbb9091bf | ||
|
|
59ef598b49 | ||
|
|
e5057c6a83 | ||
|
|
b84e09cd7b | ||
|
|
b5245578b5 | ||
|
|
56cbea7928 | ||
|
|
9acb2b3eb7 | ||
|
|
93b1d04dab | ||
|
|
aeb506659c | ||
|
|
192a773da3 | ||
|
|
301154989a | ||
|
|
1ddf6a1822 | ||
|
|
a9fdbab409 | ||
|
|
e05a89ff18 | ||
|
|
3c21d98474 | ||
|
|
4c47d3b921 | ||
|
|
67e83400bd |
No files matched your search
@@ -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}}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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).
|
||||
|
||||
@@ -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:
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
document.body.appendChild(s);
|
||||
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}`));
|
||||
});
|
||||
|
||||
if (link3D) {
|
||||
const existingScript = document.querySelector('script[src="/assets/o3dv/o3dv.min.js"]');
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
// 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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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
|
||||
|
||||
@@ -80,6 +80,7 @@ The approval page displayed to the user shows the list of scopes requested by th
|
||||
| OpenID Connect Discovery | `/.well-known/openid-configuration` |
|
||||
| Authorization Endpoint | `/login/oauth/authorize` |
|
||||
| Access Token Endpoint | `/login/oauth/access_token` |
|
||||
| Token Introspection Endpoint | `/login/oauth/introspect` |
|
||||
| OpenID Connect UserInfo | `/login/oauth/userinfo` |
|
||||
| JSON Web Key Set | `/login/oauth/keys` |
|
||||
|
||||
|
||||
+2
-2
@@ -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.
|
||||
|
||||
+4
-4
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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-@[email protected] gitea-@version@-linux-amd64
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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`.
|
||||
+24
-20
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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).
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -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.
|
||||
+301
-234
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,6 @@ sidebar_position: 110
|
||||
|
||||
aliases:
|
||||
- /zh-cn/adding-legal-pages
|
||||
|
||||
---
|
||||
|
||||
# 添加法律页面
|
||||
|
||||
+69
-61
@@ -10,7 +10,7 @@ aliases:
|
||||
|
||||
## 轻量级目录访问协议(Lightweight Directory Access Protocol,LDAP)
|
||||
|
||||
通过BindDN的LDAP和简单认证方式LDAP共享以下字段:
|
||||
通过 BindDN 的 LDAP 和简单认证方式 LDAP 共享以下字段:
|
||||
|
||||
- 认证名称 **(必选)**
|
||||
|
||||
@@ -27,48 +27,52 @@ aliases:
|
||||
- 例如: LDAP `389`/ LDAPs `636`
|
||||
|
||||
- 安全协议 (可选)
|
||||
- 连接LDAP服务器时是否使用TLS协议。
|
||||
|
||||
- 连接 LDAP 服务器时是否使用 TLS 协议。
|
||||
|
||||
- 管理员过滤规则 (可选)
|
||||
- 一个LDAP过滤器,用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件,则该用户将被授予管理员权限。
|
||||
|
||||
- 一个 LDAP 过滤器,用于指定哪些用户应该被赋予管理员特权。如果用户帐户符合过滤器条件,则该用户将被授予管理员权限。
|
||||
- 示例:`(objectClass=adminAccount)`
|
||||
- 适用于Microsoft Active Directory(AD)的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
|
||||
- 适用于 Microsoft Active Directory(AD)的示例:`memberOf=CN=admin-group,OU=example,DC=example,DC=org`
|
||||
|
||||
- 用户名属性(可选)
|
||||
|
||||
- 用户LDAP记录中包含用户名称的属性。在第一次成功登录后,将使用指定的属性值作为新的Gitea账户用户名。若留空,则使用登录表单上提供的用户名。
|
||||
- 当提供的登录名与多个属性匹配时,这一选项非常有用,但是只有一个特定属性应该用于Gitea账户名称,请参阅"用户过滤器"。
|
||||
- 用户 LDAP 记录中包含用户名称的属性。在第一次成功登录后,将使用指定的属性值作为新的 Gitea 账户用户名。若留空,则使用登录表单上提供的用户名。
|
||||
- 当提供的登录名与多个属性匹配时,这一选项非常有用,但是只有一个特定属性应该用于 Gitea 账户名称,请参阅"用户过滤器"。
|
||||
- 示例:uid
|
||||
- 适用于Microsoft Active Directory(AD)的示例:`sAMAccountName`
|
||||
- 适用于 Microsoft Active Directory(AD)的示例:`sAMAccountName`
|
||||
|
||||
- 名字属性(可选)
|
||||
|
||||
- 用户LDAP记录中包含用户名字的属性。将用于填充他们的账户信息。
|
||||
- 用户 LDAP 记录中包含用户名字的属性。将用于填充他们的账户信息。
|
||||
- 示例:givenName
|
||||
|
||||
- 姓氏属性(可选)
|
||||
- 用户LDAP记录中包含用户姓氏的属性。将用于填充他们的账户信息。
|
||||
|
||||
- 用户 LDAP 记录中包含用户姓氏的属性。将用于填充他们的账户信息。
|
||||
- 示例:`sn`
|
||||
|
||||
- 电子邮件属性 **(必选)**
|
||||
- 用户LDAP记录中包含用户电子邮件地址的属性。将用于填充他们的账户信息。
|
||||
- 用户 LDAP 记录中包含用户电子邮件地址的属性。将用于填充他们的账户信息。
|
||||
- 示例:`mail`
|
||||
|
||||
### LDAP(via BindDN)
|
||||
|
||||
需要额外设置以下字段:
|
||||
|
||||
- 绑定DN (可选)
|
||||
- 绑定 DN (可选)
|
||||
|
||||
- 搜索用户时绑定到LDAP服务器的DN。这可以留空以执行匿名搜索。
|
||||
- 搜索用户时绑定到 LDAP 服务器的 DN。这可以留空以执行匿名搜索。
|
||||
- 示例: `cn=Search,dc=mydomain,dc=com`
|
||||
|
||||
- 绑定密码 (可选)
|
||||
|
||||
- 上述指定的Bind DN(绑定区别名)的密码,如果有的话。注意:该密码在服务器上使用SECRET_KEY进行加密存储。仍然建议确保Bind DN具有尽可能少的权限。
|
||||
- 上述指定的 Bind DN(绑定区别名)的密码,如果有的话。注意:该密码在服务器上使用 SECRET_KEY 进行加密存储。仍然建议确保 Bind DN 具有尽可能少的权限。
|
||||
|
||||
- 用户搜索基准 **(必选)**
|
||||
|
||||
- 这是用于搜索用户帐户的LDAP基础路径.
|
||||
- 这是用于搜索用户帐户的 LDAP 基础路径.
|
||||
- 示例: `ou=Users,dc=mydomain,dc=com`
|
||||
|
||||
- 用户过滤规则 **(必选)**
|
||||
@@ -79,19 +83,19 @@ aliases:
|
||||
- 如需多次替换,应使用 `%[1]s`,例如在将提供的登录名与多个属性(如用户标识符、电子邮件甚至电话号码)进行匹配时。
|
||||
- 示例: `(&(objectClass=Person)(|(uid=%[1]s)(mail=%[1]s)(mobile=%[1]s)))`
|
||||
- 启用用户同步
|
||||
- 这个选项启用了一个周期性任务,用于将Gitea用户与LDAP服务器进行同步。默认的同步周期是每24小时,
|
||||
但您可以在app.ini文件中进行更改。
|
||||
- 这个选项启用了一个周期性任务,用于将 Gitea 用户与 LDAP 服务器进行同步。默认的同步周期是每 24 小时,
|
||||
但您可以在 app.ini 文件中进行更改。
|
||||
有关此部分的详细说明,请参阅[sample
|
||||
app.ini](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
|
||||
的_cron.sync_external_users_ 部分的注释。前面提到的_User Search Base_和_User Filter_
|
||||
设置将限制哪些用户可以使用Gitea以及哪些用户将被同步。
|
||||
在初始运行任务时,将根据给定的设置创建所有与LDAP匹配的用户,因此在使用大型企业LDAP目录时需要小心。
|
||||
的*cron.sync_external_users* 部分的注释。前面提到的*User Search Base*和*User Filter*
|
||||
设置将限制哪些用户可以使用 Gitea 以及哪些用户将被同步。
|
||||
在初始运行任务时,将根据给定的设置创建所有与 LDAP 匹配的用户,因此在使用大型企业 LDAP 目录时需要小心。
|
||||
|
||||
### LDAP(simple auth)
|
||||
|
||||
需要额外设置以下字段:
|
||||
|
||||
- 用户DN **(必选)**
|
||||
- 用户 DN **(必选)**
|
||||
|
||||
- 用作用户 DN 的模板。匹配参数 `%s` 将替换为登录表单中的登录名。
|
||||
- 示例: `cn=%s,ou=Users,dc=mydomain,dc=com`
|
||||
@@ -108,11 +112,12 @@ aliases:
|
||||
- 示例: `(&(objectClass=posixAccount)(|(cn=%[1]s)(mail=%[1]s)))`
|
||||
- 示例: `(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))`
|
||||
|
||||
### 使用LDAP验证分组成员
|
||||
### 使用 LDAP 验证分组成员
|
||||
|
||||
使用以下字段:
|
||||
|
||||
- 群组搜索基础DN(可选)
|
||||
- 群组搜索基础 DN(可选)
|
||||
|
||||
- 组使用的 LDAP DN。
|
||||
- 示例: `ou=group,dc=mydomain,dc=com`
|
||||
|
||||
@@ -132,43 +137,46 @@ aliases:
|
||||
|
||||
## 可插拔式认证模块(Pluggable Authentication Module,PAM)
|
||||
|
||||
这个过程启用了PAM(Pluggable Authentication Modules)认证。用户仍然可以通过用户管理手动添加到系统中。
|
||||
PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加到当前数据库中。为了与普通的Linux密码一起使用,
|
||||
运行Gitea的用户还必须具有对`/etc/shadow`的读取权限,以便在使用公钥登录时检查账户的有效性。
|
||||
这个过程启用了 PAM(Pluggable Authentication Modules)认证。用户仍然可以通过用户管理手动添加到系统中。
|
||||
PAM 提供了一种机制,通过对用户进行 PAM 认证来自动将其添加到当前数据库中。为了与普通的 Linux 密码一起使用,
|
||||
运行 Gitea 的用户还必须具有对`/etc/shadow`的读取权限,以便在使用公钥登录时检查账户的有效性。
|
||||
|
||||
**注意**:如果用户已将SSH公钥添加到Gitea中,使用这些密钥可能会绕过登录检查系统。因此,
|
||||
如果您希望禁用使用PAM进行身份验证的用户,应该在Gitea中手动禁用该账户,使用内置的用户管理功能。
|
||||
**注意**:如果用户已将 SSH 公钥添加到 Gitea 中,使用这些密钥可能会绕过登录检查系统。因此,
|
||||
如果您希望禁用使用 PAM 进行身份验证的用户,应该在 Gitea 中手动禁用该账户,使用内置的用户管理功能。
|
||||
|
||||
1. 配置和安装准备.
|
||||
- 建议您创建一个管理用户.
|
||||
- 建议取消自动注册.
|
||||
1. 一旦数据库已初始化完成,使用新创建的管理员账户登录.
|
||||
1. 导航至用户设置(右上角的图标),然后选择
|
||||
`Site Administration` -> `Authentication Sources`, 并选择
|
||||
`Add Authentication Source`.
|
||||
`Site Administration` -> `Authentication Sources`, 并选择
|
||||
`Add Authentication Source`.
|
||||
1. 填写字段如下:
|
||||
- 认证类型:`PAM`。
|
||||
- 名称:任何有效的值都可以,如果您愿意,可以使用"System Authentication"。
|
||||
- PAM服务名称:从/etc/pam.d/目录下选择适用于所需认证的正确文件[^1]。
|
||||
- PAM电子邮件域:用户认证时要附加的电子邮件后缀。例如,如果登录系统期望一个名为gituse的用户,
|
||||
并且将此字段设置为mail.com,那么Gitea在验证一个GIT实例的用户时将期望user emai字段为gituser@mail.com[^2]。
|
||||
- PAM 服务名称:从/etc/pam.d/目录下选择适用于所需认证的正确文件[^1]。
|
||||
- PAM 电子邮件域:用户认证时要附加的电子邮件后缀。例如,如果登录系统期望一个名为 gituse 的用户,
|
||||
并且将此字段设置为 mail.com,那么 Gitea 在验证一个 GIT 实例的用户时将期望 user emai 字段为gituser@mail.com[^2]。
|
||||
|
||||
**Note**: PAM 支持通过[build-time flags](installation/from-source.md#build)添加,
|
||||
而官方提供的二进制文件通常不会默认启用此功能。PAM需要确保系统上有必要的libpam动态库,并且编译器可以访问必要的PAM开发头文件。
|
||||
而官方提供的二进制文件通常不会默认启用此功能。PAM 需要确保系统上有必要的 libpam 动态库,并且编译器可以访问必要的 PAM 开发头文件。
|
||||
|
||||
[^1]: 例如,在Debian "Bullseye"上使用标准Linux登录,可以使用`common-session-noninteractive`。这个值对于其他版本的Debian,
|
||||
包括Ubuntu和Mint,可能也是有效的,请查阅您所使用发行版的文档以确认。
|
||||
[^1]:
|
||||
例如,在 Debian "Bullseye"上使用标准 Linux 登录,可以使用`common-session-noninteractive`。这个值对于其他版本的 Debian,
|
||||
包括 Ubuntu 和 Mint,可能也是有效的,请查阅您所使用发行版的文档以确认。
|
||||
|
||||
[^2]: **PAM的必选项** 请注意:在上面的示例中,用户将作为`gituser`而不是`[email protected]`登录到Gitea的Web界面。
|
||||
[^2]: **PAM 的必选项** 请注意:在上面的示例中,用户将作为`gituser`而不是`[email protected]`登录到 Gitea 的 Web 界面。
|
||||
|
||||
## 简单邮件传输协议(Simple Mail Transfer Protocol,SMTP)
|
||||
|
||||
此选项允许 Gitea 以 Gitea 用户身份登录 SMTP 主机。请设置以下字段:
|
||||
|
||||
- 身份验证名称 **(必选)**
|
||||
|
||||
- 分配给新授权方法的名称
|
||||
|
||||
- SMTP 验证类型 **(必选)**
|
||||
|
||||
- 用于连接 SMTP 主机的验证类型,plain 或 login
|
||||
|
||||
- 主机名 **(必选)**
|
||||
@@ -188,7 +196,7 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
|
||||
- 示例: `gitea.com,mydomain.com,mydomain2.com`
|
||||
|
||||
- 强制使用 SMTPS
|
||||
- 默认情况下将使用SMTPS连接到端口465.如果您希望将smtp用于其他端口,自行设置
|
||||
- 默认情况下将使用 SMTPS 连接到端口 465.如果您希望将 smtp 用于其他端口,自行设置
|
||||
- 否则,如果服务器提供' STARTTLS '扩展名,则将使用此扩展名
|
||||
- 跳过 TLS 验证
|
||||
- 禁用 TLS 验证身份.
|
||||
@@ -199,7 +207,7 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
|
||||
|
||||
- 要使用 FreeIPA 凭据登录 Gitea,需要为 Gitea 创建一个绑定帐户。
|
||||
创建一个绑定帐户:
|
||||
- 在FreeIPA服务器上创建一个gitea.ldif文件,并将`dc=example,dc=com`替换为您的`dn`,然后提供一个适当安全的密码。
|
||||
- 在 FreeIPA 服务器上创建一个 gitea.ldif 文件,并将`dc=example,dc=com`替换为您的`dn`,然后提供一个适当安全的密码。
|
||||
|
||||
```sh
|
||||
dn: uid=gitea,cn=sysaccounts,cn=etc,dc=example,dc=com
|
||||
@@ -212,33 +220,33 @@ PAM提供了一种机制,通过对用户进行PAM认证来自动将其添加
|
||||
nsIdleTimeout: 0
|
||||
```
|
||||
|
||||
- 导入LDIF文件(如果需要,请将localhost更改为IPA服务器)。系统会提示您输入Directory Manager的密码。:
|
||||
- 导入 LDIF 文件(如果需要,请将 localhost 更改为 IPA 服务器)。系统会提示您输入 Directory Manager 的密码。:
|
||||
|
||||
```sh
|
||||
ldapmodify -h localhost -p 389 -x -D \
|
||||
"cn=Directory Manager" -W -f gitea.ldif
|
||||
```
|
||||
|
||||
- 为`gitea_users`添加IPA组:
|
||||
- 为`gitea_users`添加 IPA 组:
|
||||
|
||||
```sh
|
||||
ipa group-add --desc="Gitea Users" gitea_users
|
||||
```
|
||||
|
||||
- **提示**:对于IPA凭证错误,运行' kinit admin '并提供域管理帐户密码.
|
||||
- 以管理员身份登录Gitea,点击Admin Panel下的`Authentication`。然后单击`Add New Source`并填写详细信息,更改所有适当的地方。
|
||||
- **提示**:对于 IPA 凭证错误,运行' kinit admin '并提供域管理帐户密码.
|
||||
- 以管理员身份登录 Gitea,点击 Admin Panel 下的`Authentication`。然后单击`Add New Source`并填写详细信息,更改所有适当的地方。
|
||||
|
||||
## SPNEGO with SSPI (Kerberos/NTLM, for Windows only)
|
||||
|
||||
Gitea支持通过Windows内置的安全支持提供程序接口(Security Support Provider Interface,SSPI)实现SPNEGO单点登录认证(由RFC4559定义的方案),用于服务器的Web部分。SSPI仅在Windows环境中工作,即当服务器和客户端都在Windows操作系统上运行时。
|
||||
Gitea 支持通过 Windows 内置的安全支持提供程序接口(Security Support Provider Interface,SSPI)实现 SPNEGO 单点登录认证(由 RFC4559 定义的方案),用于服务器的 Web 部分。SSPI 仅在 Windows 环境中工作,即当服务器和客户端都在 Windows 操作系统上运行时。
|
||||
|
||||
在激活SSPI单点登录认证(SSO)之前,您需要准备您的环境:
|
||||
在激活 SSPI 单点登录认证(SSO)之前,您需要准备您的环境:
|
||||
|
||||
- 在Active Directory中创建一个单独的用户账户,gitea.exe 进程将在该账户下运行(例如,在domain.local域下创建一个名为user的账户:
|
||||
- 为运行gitea.exe的主机创建一个服务主体名称(Service Principal Name,SPN),其类别为HTTP:
|
||||
- 在 Active Directory 中创建一个单独的用户账户,gitea.exe 进程将在该账户下运行(例如,在 domain.local 域下创建一个名为 user 的账户:
|
||||
- 为运行 gitea.exe 的主机创建一个服务主体名称(Service Principal Name,SPN),其类别为 HTTP:
|
||||
|
||||
- 以特权域用户(例如域管理员)的身份启动“命令提示符”或“PowerShell”。
|
||||
- 运行下面的命令,将host.domain.local替换为Web应用程序将运行的服务器的完全限定域名(FQDN),将domain\user替换为在前一步中创建的账户名称:
|
||||
- 运行下面的命令,将 host.domain.local 替换为 Web 应用程序将运行的服务器的完全限定域名(FQDN),将 domain\user 替换为在前一步中创建的账户名称:
|
||||
|
||||
```sh
|
||||
setspn -A HTTP/host.domain.local domain\user
|
||||
@@ -247,22 +255,22 @@ Gitea支持通过Windows内置的安全支持提供程序接口(Security Suppo
|
||||
在遵循上述步骤之前,请确保您按照以下流程进行操作:
|
||||
|
||||
1. 用之前创建的用户登录(如果已经登录,请先注销)。
|
||||
2. 确保在`custom/conf/app.ini`文件的`[server]`部分中,`ROOT_URL`设置为Web应用程序将运行的服务器的完全限定域名(FQDN),与之前创建服务主体名称时使用的一致(例如,`host.domain.local`)。
|
||||
3. 启动Web服务器(运行 `gitea.exe web`)。
|
||||
4. 在 `Site Administration -> Authentication Sources` 中添加一个 `SPNEGO with SSPI` 认证源,以启用SSPI认证。
|
||||
2. 确保在`custom/conf/app.ini`文件的`[server]`部分中,`ROOT_URL`设置为 Web 应用程序将运行的服务器的完全限定域名(FQDN),与之前创建服务主体名称时使用的一致(例如,`host.domain.local`)。
|
||||
3. 启动 Web 服务器(运行 `gitea.exe web`)。
|
||||
4. 在 `Site Administration -> Authentication Sources` 中添加一个 `SPNEGO with SSPI` 认证源,以启用 SSPI 认证。
|
||||
5. 在域中的客户端计算机上,使用任何域用户登录(与运行`gitea.exe`的服务器不同)。
|
||||
6. 如果您使用Chrome或Edge浏览器,请将Web应用程序的URL添加到“本地站点”(`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
|
||||
7. 启动Chrome或Edge浏览器,导航到Gitea的FQDN URL(例如,`http://host.domain.local:3000`)。
|
||||
8. 在控制面板中点击“Sign In”按钮,然后选择SSPI,将会自动使用当前登录到计算机的用户进行登录。
|
||||
6. 如果您使用 Chrome 或 Edge 浏览器,请将 Web 应用程序的 URL 添加到“本地站点”(`Internet选项 -> 安全 -> 本地站点 -> 站点`)。
|
||||
7. 启动 Chrome 或 Edge 浏览器,导航到 Gitea 的 FQDN URL(例如,`http://host.domain.local:3000`)。
|
||||
8. 在控制面板中点击“Sign In”按钮,然后选择 SSPI,将会自动使用当前登录到计算机的用户进行登录。
|
||||
9. 如果无法正常工作,请确保:
|
||||
- 您不是在运行`gitea.exe`的同一台服务器上运行Web浏览器。应该在与服务器不同的域加入计算机(客户端)上运行Web浏览器。如果客户端和服务器都在同一台计算机上运行,则NTLM将优先于Kerberos。
|
||||
- 主机上只有一个`HTTP/...`的SPN。
|
||||
- SPN中只包含主机名,不包含端口号。
|
||||
- 将Web应用程序的URL添加到"本地站点"。
|
||||
- 服务器和客户端的时钟差异不超过5分钟(取决于组策略)。
|
||||
- 在Internet Explorer中启用了"集成Windows身份验证"(在"高级设置"下)。
|
||||
- 您不是在运行`gitea.exe`的同一台服务器上运行 Web 浏览器。应该在与服务器不同的域加入计算机(客户端)上运行 Web 浏览器。如果客户端和服务器都在同一台计算机上运行,则 NTLM 将优先于 Kerberos。
|
||||
- 主机上只有一个`HTTP/...`的 SPN。
|
||||
- SPN 中只包含主机名,不包含端口号。
|
||||
- 将 Web 应用程序的 URL 添加到"本地站点"。
|
||||
- 服务器和客户端的时钟差异不超过 5 分钟(取决于组策略)。
|
||||
- 在 Internet Explorer 中启用了"集成 Windows 身份验证"(在"高级设置"下)。
|
||||
|
||||
遵循这些步骤,您应该能够成功启用和使用SSPI单点登录认证(SSO)。
|
||||
遵循这些步骤,您应该能够成功启用和使用 SSPI 单点登录认证(SSO)。
|
||||
|
||||
## 反向代理认证
|
||||
|
||||
@@ -279,7 +287,7 @@ ENABLE_REVERSE_PROXY_AUTHENTICATION = true
|
||||
|
||||
如果设置了 `ENABLE_REVERSE_PROXY_FULL_NAME=true`,则用户的全名会从 `X-WEBAUTH-FULLNAME` 读取,这样在自动创建用户时将使用这个字段作为用户全名,你也可以通过修改 `REVERSE_PROXY_AUTHENTICATION_FULL_NAME` 来变更 HTTP 头。
|
||||
|
||||
你也可以通过修改 `REVERSE_PROXY_TRUSTED_PROXIES` 来设置反向代理的IP地址范围,加强安全性,默认值是 `127.0.0.0/8,::1/128`。 通过 `REVERSE_PROXY_LIMIT`, 可以设置最多信任几级反向代理。
|
||||
你也可以通过修改 `REVERSE_PROXY_TRUSTED_PROXIES` 来设置反向代理的 IP 地址范围,加强安全性,默认值是 `127.0.0.0/8,::1/128`。 通过 `REVERSE_PROXY_LIMIT`, 可以设置最多信任几级反向代理。
|
||||
|
||||
你可以通过以下配置为 API 启用此认证方法:
|
||||
|
||||
|
||||
+10
-11
@@ -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` 命令有一些注意事项。
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ sidebar_position: 20
|
||||
|
||||
aliases:
|
||||
- /zh-cn/cmd-embedded
|
||||
|
||||
---
|
||||
|
||||
# 嵌入资源提取工具
|
||||
@@ -30,7 +29,7 @@ gitea embedded list [--include-vendored] [patterns...]
|
||||
|
||||
- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
|
||||
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
|
||||
列出 `public/assets/img` 目录下的所有文件:`public/assets/img/**`
|
||||
列出 `public/assets/img` 目录下的所有文件:`public/assets/img/**`
|
||||
|
||||
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ sidebar_position: 1
|
||||
|
||||
aliases:
|
||||
- /zh-cn/command-line
|
||||
|
||||
---
|
||||
|
||||
# 命令行
|
||||
@@ -61,7 +60,7 @@ aliases:
|
||||
- 选项:
|
||||
- `--email`:要删除的用户的电子邮件。
|
||||
- `--username`:要删除的用户的用户名。
|
||||
- `--id`:要删除的用户的ID。
|
||||
- `--id`:要删除的用户的 ID。
|
||||
- 必须提供 `--id`、`--username` 或 `--email` 中的一个。如果提供多个,则所有条件必须匹配。
|
||||
- 示例:
|
||||
- `gitea admin user delete --id 1`
|
||||
@@ -283,12 +282,12 @@ aliases:
|
||||
|
||||
### cert
|
||||
|
||||
生成自签名的SSL证书。将输出到当前目录下的`cert.pem`和`key.pem`文件中,并且会覆盖任何现有文件。
|
||||
生成自签名的 SSL 证书。将输出到当前目录下的`cert.pem`和`key.pem`文件中,并且会覆盖任何现有文件。
|
||||
|
||||
- 选项:
|
||||
- `--host value`:逗号分隔的主机名和IP地址列表,此证书适用于这些主机。支持使用通配符。必填。
|
||||
- `--ecdsa-curve value`:用于生成密钥的ECDSA曲线。可选。有效选项为P224、P256、P384、P521。
|
||||
- `--rsa-bits value`:要生成的RSA密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:3072)。
|
||||
- `--host value`:逗号分隔的主机名和 IP 地址列表,此证书适用于这些主机。支持使用通配符。必填。
|
||||
- `--ecdsa-curve value`:用于生成密钥的 ECDSA 曲线。可选。有效选项为 P224、P256、P384、P521。
|
||||
- `--rsa-bits value`:要生成的 RSA 密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:3072)。
|
||||
- `--start-date value`:证书的创建日期。可选。(格式:`Jan 1 15:04:05 2011`)。
|
||||
- `--duration value`:证书有效期。可选。(默认值:8760h0m0s)
|
||||
- `--ca`:如果提供此选项,则证书将生成自己的证书颁发机构。可选。
|
||||
@@ -297,18 +296,18 @@ aliases:
|
||||
|
||||
### dump
|
||||
|
||||
将所有文件和数据库导出到一个zip文件中。输出文件将保存在当前目录下,类似于`gitea-dump-1482906742.zip`。
|
||||
将所有文件和数据库导出到一个 zip 文件中。输出文件将保存在当前目录下,类似于`gitea-dump-1482906742.zip`。
|
||||
|
||||
- 选项:
|
||||
- `--file name`,`-f name`:指定要创建的导出文件的名称。可选。(默认值:gitea-dump-[timestamp].zip)。
|
||||
- `--tempdir path`,`-t path`:指定临时目录的路径。可选。(默认值:/tmp)。
|
||||
- `--skip-repository`,`-R`:跳过仓库的导出。可选。
|
||||
- `--skip-custom-dir`:跳过自定义目录的导出。可选。
|
||||
- `--skip-lfs-data`:跳过LFS数据的导出。可选。
|
||||
- `--skip-lfs-data`:跳过 LFS 数据的导出。可选。
|
||||
- `--skip-attachment-data`:跳过附件数据的导出。可选。
|
||||
- `--skip-package-data`:跳过包数据的导出。可选。
|
||||
- `--skip-log`:跳过日志数据的导出。可选。
|
||||
- `--database`,`-d`:指定数据库的SQL语法。可选。
|
||||
- `--database`,`-d`:指定数据库的 SQL 语法。可选。
|
||||
- `--verbose`,`-V`:如果提供此选项,显示附加详细信息。可选。
|
||||
- `--type`:设置导出的格式。可选。(默认值:zip)
|
||||
- 示例:
|
||||
@@ -401,19 +400,19 @@ gitea doctor recreate-table
|
||||
|
||||
- 命令:
|
||||
- `shutdown`: 优雅地关闭运行中的进程
|
||||
- `restart`: 优雅地重新启动运行中的进程(对于Windows服务器尚未实现)
|
||||
- `restart`: 优雅地重新启动运行中的进程(对于 Windows 服务器尚未实现)
|
||||
- `flush-queues`: 刷新运行中的进程中的队列
|
||||
- 选项:
|
||||
- `--timeout value`: 刷新过程的超时时间(默认值: 1m0s)
|
||||
- `--non-blocking`: 设置为true,以在返回之前不等待刷新完成
|
||||
- `--non-blocking`: 设置为 true,以在返回之前不等待刷新完成
|
||||
- `logging`: 调整日志命令
|
||||
- 命令:
|
||||
- `pause`: 暂停日志记录
|
||||
- 注意:
|
||||
- 如果日志级别低于此级别,日志级别将被临时提升为INFO。
|
||||
- Gitea将在一定程度上缓冲日志,并在超过该点后丢弃日志。
|
||||
- 如果日志级别低于此级别,日志级别将被临时提升为 INFO。
|
||||
- Gitea 将在一定程度上缓冲日志,并在超过该点后丢弃日志。
|
||||
- `resume`: 恢复日志记录
|
||||
- `release-and-reopen`: 使Gitea释放和重新打开用于日志记录的文件和连接(相当于向Gitea发送SIGUSR1信号)。
|
||||
- `release-and-reopen`: 使 Gitea 释放和重新打开用于日志记录的文件和连接(相当于向 Gitea 发送 SIGUSR1 信号)。
|
||||
- `remove name`: 删除指定的日志记录器
|
||||
- 选项:
|
||||
- `--group group`, `-g group`: 从中删除子记录器的组(默认为`default`)
|
||||
@@ -429,7 +428,7 @@ gitea doctor recreate-table
|
||||
- `--expression value`, `-e value`: 日志记录器的匹配表达式
|
||||
- `--prefix value`, `-p value`: 日志记录器的前缀
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--stderr`: 将控制台日志输出到stderr - 仅适用于控制台
|
||||
- `--stderr`: 将控制台日志输出到 stderr - 仅适用于控制台
|
||||
- `file`: 添加文件日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
@@ -459,9 +458,9 @@ gitea doctor recreate-table
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--reconnect-on-message`, `-R`: 对于每个消息重新连接主机
|
||||
- `--reconnect`, `-r`: 连接中断时重新连接主机
|
||||
- `--protocol value`, `-P value`: 设置要使用的协议:tcp、unix或udp(默认为tcp)
|
||||
- `--protocol value`, `-P value`: 设置要使用的协议:tcp、unix 或 udp(默认为 tcp)
|
||||
- `--address value`, `-a value`: 要连接到的主机地址和端口(默认为:7020)
|
||||
- `smtp`: 添加SMTP日志记录器
|
||||
- `smtp`: 添加 SMTP 日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
|
||||
|
||||
+210
-209
File diff suppressed because it is too large.
Load diff
+2
-3
@@ -5,14 +5,13 @@ sidebar_position: 100
|
||||
|
||||
aliases:
|
||||
- /zh-cn/customizing-gitea
|
||||
|
||||
---
|
||||
|
||||
# 自定义 Gitea 配置
|
||||
|
||||
Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板等默认配置。
|
||||
|
||||
如果从二进制部署 Gitea ,则所有默认路径都将相对于该 gitea 二进制文件;如果从发行版安装,则可能会将这些路径修改为Linux文件系统标准。Gitea
|
||||
如果从二进制部署 Gitea ,则所有默认路径都将相对于该 gitea 二进制文件;如果从发行版安装,则可能会将这些路径修改为 Linux 文件系统标准。Gitea
|
||||
将会自动创建包括 `custom/` 在内的必要应用目录,应用本身的配置存放在
|
||||
`custom/conf/app.ini` 当中。在发行版中可能会以 `/etc/gitea/` 的形式为 `custom` 设置一个符号链接,查看配置详情请移步:
|
||||
|
||||
@@ -66,7 +65,7 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
|
||||
|
||||
除了 `extra_links.tmpl` 和 `extra_tabs.tmpl`,您可以在您的 `custom/templates/custom/` 目录中存放一些其他有用的模板,例如:
|
||||
|
||||
- `header.tmpl`,在 `<head>` 标记结束之前的模板,例如添加自定义CSS文件
|
||||
- `header.tmpl`,在 `<head>` 标记结束之前的模板,例如添加自定义 CSS 文件
|
||||
- `body_outer_pre.tmpl`,在 `<body>` 标记开始处的模板
|
||||
- `body_inner_pre.tmpl`,在顶部导航栏之前,但在主 container 内部的模板,例如添加一个 `<div class="full height">`
|
||||
- `body_inner_post.tmpl`,在主 container 结束处的模板
|
||||
|
||||
@@ -5,7 +5,6 @@ sidebar_position: 12
|
||||
|
||||
aliases:
|
||||
- /zh-cn/email-setup
|
||||
|
||||
---
|
||||
|
||||
# Email 设置
|
||||
@@ -16,9 +15,9 @@ Gitea 具有邮件功能,用于发送事务性邮件(例如注册确认邮
|
||||
|
||||
使用 `sendmail` 命令作为邮件传输代理(mailer)。
|
||||
|
||||
注意:对于在官方Gitea Docker镜像中使用,请使用SMTP版本进行配置(请参考下一节)。
|
||||
注意:对于在官方 Gitea Docker 镜像中使用,请使用 SMTP 版本进行配置(请参考下一节)。
|
||||
|
||||
注意:对于面向互联网的网站,请查阅您的 MTA 文档以了解通过TLS发送邮件的说明。同时设置 SPF、DMARC 和 DKIM DNS 记录,以使发送的邮件被各个电子邮件提供商接受为合法邮件。
|
||||
注意:对于面向互联网的网站,请查阅您的 MTA 文档以了解通过 TLS 发送邮件的说明。同时设置 SPF、DMARC 和 DKIM DNS 记录,以使发送的邮件被各个电子邮件提供商接受为合法邮件。
|
||||
|
||||
```ini title="app.ini"
|
||||
[mailer]
|
||||
@@ -55,9 +54,9 @@ PASSWD = `password`
|
||||
- 通过端口 587 的 STARTTLS(也称为 Opportunistic TLS)。初始连接是明文的,但如果服务器支持,则可以升级为 TLS。
|
||||
- 通过默认端口 465 的 SMTPS 连接。连接到服务器从一开始就使用 TLS。
|
||||
- 使用 `PROTOCOL=smtps` 进行强制的 SMTPS 连接。(这两种方式都被称为 Implicit TLS)
|
||||
这是由于 Go 内部库对 STRIPTLS 攻击的保护机制。
|
||||
这是由于 Go 内部库对 STRIPTLS 攻击的保护机制。
|
||||
|
||||
请注意,自2018年起,[RFC8314](https://tools.ietf.org/html/rfc8314#section-3) 推荐使用 Implicit TLS。
|
||||
请注意,自 2018 年起,[RFC8314](https://tools.ietf.org/html/rfc8314#section-3) 推荐使用 Implicit TLS。
|
||||
|
||||
### Gmail
|
||||
|
||||
|
||||
+14
-15
@@ -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 的形式运行。
|
||||
+3
-3
@@ -5,7 +5,6 @@ sidebar_position: 60
|
||||
|
||||
aliases:
|
||||
- /zh-cn/external-renderers
|
||||
|
||||
---
|
||||
|
||||
# 外部渲染器
|
||||
@@ -24,7 +23,7 @@ Gitea 通过外部二进制文件支持自定义文件渲染(例如 Jupyter no
|
||||
如果您正在使用 Docker 镜像,则您的 `Dockerfile` 应该包含以下内容:
|
||||
|
||||
```docker
|
||||
FROM docker.io/gitea/gitea:@dockerVersion@
|
||||
FROM docker.gitea.com/gitea:@dockerVersion@
|
||||
[...]
|
||||
|
||||
COPY custom/app.ini /data/gitea/conf/app.ini
|
||||
@@ -171,7 +170,8 @@ ALLOW_DATA_URI_IMAGES = true
|
||||
|
||||
.markup.XXXXX body {
|
||||
color: #444;
|
||||
font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
|
||||
font-family: Georgia, Palatino, "Palatino Linotype", Times, "Times New Roman",
|
||||
serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
padding: 1em;
|
||||
|
||||
@@ -5,7 +5,6 @@ sidebar_position: 16
|
||||
|
||||
aliases:
|
||||
- /zh-cn/fail2ban-setup
|
||||
|
||||
---
|
||||
|
||||
# 设置 Fail2ban
|
||||
|
||||
@@ -5,7 +5,6 @@ sidebar_position: 12
|
||||
|
||||
aliases:
|
||||
- /zh-cn/git-lfs-setup
|
||||
|
||||
---
|
||||
|
||||
# Git LFS 设置
|
||||
|
||||
+15
-13
@@ -18,7 +18,7 @@ aliases:
|
||||
目前,以下通知事件使用模板:
|
||||
|
||||
| 操作名称 | 用途 |
|
||||
| ----------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| ---------- | ---------------------------------------------------------------------- |
|
||||
| `new` | 创建了新的工单或合并请求。 |
|
||||
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
|
||||
| `close` | 关闭了工单或合并请求。 |
|
||||
@@ -72,10 +72,10 @@ custom/templates/mail/pull/comment.tmpl
|
||||
|
||||
指定 _主题_ 部分是可选的(因此也是虚线分隔符)。在使用时,_主题_ 和 _邮件正文_ 模板之间的分隔符需要至少三个虚线;分隔符行中不允许使用其他字符。
|
||||
|
||||
_主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
|
||||
_主题_ 和 _邮件正文_ 由 [Golang 的模板引擎](https://go.dev/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
|
||||
|
||||
| 名称 | 类型 | 可用性 | 用途 |
|
||||
| -------------------- | ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ------------------ | ---------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
|
||||
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_。 |
|
||||
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
|
||||
@@ -107,7 +107,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
- 删除所有前导、尾随和多余的空格。
|
||||
- 将字符串截断为前 256 个字母(字符)。
|
||||
|
||||
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用Gitea的**内部默认值**。
|
||||
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用 Gitea 的**内部默认值**。
|
||||
|
||||
内部默认(回退)主题相当于:
|
||||
|
||||
@@ -117,7 +117,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
|
||||
例如:`Re: [mike/stuff] New color palette (#38)`
|
||||
|
||||
即使存在有效的主题模板,Gitea的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
|
||||
即使存在有效的主题模板,Gitea 的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
|
||||
|
||||
### 模板中的邮件正文部分
|
||||
|
||||
@@ -139,7 +139,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
如果模板无法呈现,则只有在发送邮件时才会注意到。
|
||||
如果主题模板失败,将使用默认主题,如果从 _邮件正文_ 中成功呈现了任何内容,则将使用该内容,忽略其他内容。
|
||||
|
||||
如果遇到问题,请检查 [Gitea的日志](../administration/logging-config.md) 以获取错误消息。
|
||||
如果遇到问题,请检查 [Gitea 的日志](../administration/logging-config.md) 以获取错误消息。
|
||||
|
||||
## 示例
|
||||
|
||||
@@ -221,11 +221,11 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
>
|
||||
> #### 消息内容
|
||||
>
|
||||
> \_********************************\_********************************
|
||||
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
|
||||
>
|
||||
> Mike, I think we should tone down the blues a little.
|
||||
>
|
||||
> \_********************************\_********************************
|
||||
> \_******\*\*******\*\*\*\*******\*\*******\_******\*\*******\*\*\*\*******\*\*******
|
||||
>
|
||||
> [在 Gitea 上查看](#)。
|
||||
|
||||
@@ -234,7 +234,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
模板系统包含一些函数,可用于进一步处理和格式化消息。以下是其中一些函数的列表:
|
||||
|
||||
| 函数名 | 参数 | 可用于 | 用法 |
|
||||
|------------------| ----------- | ------------ | ------------------------------ |
|
||||
| ---------------- | ----------- | ---------- | ------------------------------------------------ |
|
||||
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
|
||||
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
|
||||
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
|
||||
@@ -245,8 +245,10 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://go.dev/pkg/text/
|
||||
这些都是 _函数_,而不是元数据,因此必须按以下方式使用:
|
||||
|
||||
```html
|
||||
像这样使用: {{SanitizeHTML "Escape<my>text"}}
|
||||
或者这样使用: {{"Escape<my>text" | SanitizeHTML}}
|
||||
或者这样使用: {{AppUrl}}
|
||||
但不要像这样使用: {{.AppUrl}}
|
||||
像这样使用: {{SanitizeHTML "Escape<my
|
||||
>text"}} 或者这样使用: {{"Escape<my
|
||||
>text" | SanitizeHTML}} 或者这样使用: {{AppUrl}} 但不要像这样使用:
|
||||
{{.AppUrl}}</my
|
||||
></my
|
||||
>
|
||||
```
|
||||
@@ -30,7 +30,7 @@ REPO_INDEXER_EXCLUDE = resources/bin/**
|
||||
|
||||
### 按路径选择要索引的文件
|
||||
|
||||
Gitea使用 [`gobwas/glob` 库](https://github.com/gobwas/glob) 中的 glob 模式匹配来选择要包含在索引中的文件。
|
||||
Gitea 使用 [`gobwas/glob` 库](https://github.com/gobwas/glob) 中的 glob 模式匹配来选择要包含在索引中的文件。
|
||||
|
||||
限制文件列表可以防止索引被派生或无关的文件(例如 lss、sym、map 等)污染,从而使搜索结果更相关。这还有助于减小索引的大小。
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ git.example.com {
|
||||
1. 在 IIS 中设置一个空网页,比如命名为 `Gitea Proxy`。
|
||||
2. 根据[微软社区中为 IIS 设置 URL 重写的指南](https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222#M343)的前两步进行配置,也就是:
|
||||
|
||||
- 使用 Microsoft Web Platform Installer 5.1 (WebPI) 安装 Application Request Routing(简称ARR),或者在 [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing) 下载这个插件。
|
||||
- 使用 Microsoft Web Platform Installer 5.1 (WebPI) 安装 Application Request Routing(简称 ARR),或者在 [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing) 下载这个插件。
|
||||
- 一但这个模块被安装到 IIS 上,你将会在 IIS 管理控制台看到一个叫做 URL Rewrite 的新图标。
|
||||
- 打开 IIS 管理控制台,在左边的列表中点击 `Gitea Proxy` 网页。在中间选中并且双击 URL Rewrite 的图标来加载 URL 重写的面板。
|
||||
- 在管理控制台的右边选择 `Add Rule` 操作,并且在 `Inbound and Outbound Rules` 分类中选择 `Reverse Proxy Rule`。
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ User-agent: *
|
||||
Disallow: /
|
||||
```
|
||||
|
||||
如果您将Gitea安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`。
|
||||
如果您将 Gitea 安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`。
|
||||
|
||||
```txt
|
||||
User-agent: *
|
||||
|
||||
@@ -69,7 +69,7 @@ MERGES = pubkey, twofa, basesigned, commitssigned
|
||||
如果您有自己定制的 Gitea git 配置,您应该将这些配置设置在系统 git 配置文件中(例如 `/etc/gitconfig`)或者 Gitea 的内部 git 配置文件 `{[git].HOME_PATH}/.gitconfig` 中。
|
||||
|
||||
与 git 命令相关的主目录文件(如 `.gnupg`)也应该放在 Gitea 的 git 主目录 `[git].HOME_PATH` 中。
|
||||
如果您希望将 `.gnupg` 目录放在 `{[git].HOME_PATH}/` 之外的位置,请考虑设置 `$GNUPGHOME` 环境变量为您首选的位置,否则Gitea将会从 `{[git].HOME_PATH}/.gnupg` 查找私钥。
|
||||
如果您希望将 `.gnupg` 目录放在 `{[git].HOME_PATH}/` 之外的位置,请考虑设置 `$GNUPGHOME` 环境变量为您首选的位置,否则 Gitea 将会从 `{[git].HOME_PATH}/.gnupg` 查找私钥。
|
||||
:::
|
||||
|
||||
### `INITIAL_COMMIT`
|
||||
|
||||
+23
-23
@@ -10,40 +10,40 @@ aliases:
|
||||
|
||||
## 背景
|
||||
|
||||
Gitea使用Golang作为后端编程语言。它使用了许多第三方包,并且自己也编写了一些包。
|
||||
例如,Gitea使用[Chi](https://github.com/go-chi/chi)作为基本的Web框架。[Xorm](https://xorm.io)是一个用于与数据库交互的ORM框架。
|
||||
Gitea 使用 Golang 作为后端编程语言。它使用了许多第三方包,并且自己也编写了一些包。
|
||||
例如,Gitea 使用[Chi](https://github.com/go-chi/chi)作为基本的 Web 框架。[Xorm](https://xorm.io)是一个用于与数据库交互的 ORM 框架。
|
||||
因此,管理这些包非常重要。在开始编写后端代码之前,请参考以下准则。
|
||||
|
||||
## 包设计准则
|
||||
|
||||
### 包列表
|
||||
|
||||
为了保持易于理解的代码并避免循环依赖,拥有良好的代码结构是很重要的。Gitea后端分为以下几个部分:
|
||||
为了保持易于理解的代码并避免循环依赖,拥有良好的代码结构是很重要的。Gitea 后端分为以下几个部分:
|
||||
|
||||
- `build`:帮助构建Gitea的脚本。
|
||||
- `cmd`:包含所有Gitea的实际子命令,包括web、doctor、serv、hooks、admin等。`web`将启动Web服务。`serv`和`hooks`将被Git或OpenSSH调用。其他子命令可以帮助维护Gitea。
|
||||
- `build`:帮助构建 Gitea 的脚本。
|
||||
- `cmd`:包含所有 Gitea 的实际子命令,包括 web、doctor、serv、hooks、admin 等。`web`将启动 Web 服务。`serv`和`hooks`将被 Git 或 OpenSSH 调用。其他子命令可以帮助维护 Gitea。
|
||||
- `tests`:常用的测试函数
|
||||
- `tests/integration`:集成测试,用于测试后端回归。
|
||||
- `tests/e2e`:端到端测试,用于测试前端和后端的兼容性和视觉回归。
|
||||
- `models`:包含由xorm用于构建数据库表的数据结构。它还包含查询和更新数据库的函数。应避免与其他Gitea代码的依赖关系。在某些情况下,比如日志记录时可以例外。
|
||||
- `models/db`:基本的数据库操作。所有其他`models/xxx`包都应依赖于此包。`GetEngine`函数只能从models/中调用。
|
||||
- `models`:包含由 xorm 用于构建数据库表的数据结构。它还包含查询和更新数据库的函数。应避免与其他 Gitea 代码的依赖关系。在某些情况下,比如日志记录时可以例外。
|
||||
- `models/db`:基本的数据库操作。所有其他`models/xxx`包都应依赖于此包。`GetEngine`函数只能从 models/中调用。
|
||||
- `models/fixtures`:单元测试和集成测试中使用的示例数据。一个`yml`文件表示一个将在测试开始时加载到数据库中的表。
|
||||
- `models/migrations`:存储不同版本之间的数据库迁移。修改数据库结构的PR**必须**包含一个迁移步骤。
|
||||
- `modules`:在Gitea中处理特定功能的不同模块。工作正在进行中:其中一些模块应该移到`services`中,特别是那些依赖于models的模块,因为它们依赖于数据库。
|
||||
- `modules/setting`:存储从ini文件中读取的所有系统配置,并在各处引用。但是在可能的情况下,应将其作为函数参数使用。
|
||||
- `modules/git`:用于与`Git`命令行或Gogit包交互的包。
|
||||
- `public`:编译后的前端文件(JavaScript、图像、CSS等)
|
||||
- `routers`:处理服务器请求。由于它使用其他Gitea包来处理请求,因此其他包(models、modules或services)不能依赖于routers。
|
||||
- `routers/api`:包含`/api/v1`相关路由,用于处理RESTful API请求。
|
||||
- `models/migrations`:存储不同版本之间的数据库迁移。修改数据库结构的 PR**必须**包含一个迁移步骤。
|
||||
- `modules`:在 Gitea 中处理特定功能的不同模块。工作正在进行中:其中一些模块应该移到`services`中,特别是那些依赖于 models 的模块,因为它们依赖于数据库。
|
||||
- `modules/setting`:存储从 ini 文件中读取的所有系统配置,并在各处引用。但是在可能的情况下,应将其作为函数参数使用。
|
||||
- `modules/git`:用于与`Git`命令行或 Gogit 包交互的包。
|
||||
- `public`:编译后的前端文件(JavaScript、图像、CSS 等)
|
||||
- `routers`:处理服务器请求。由于它使用其他 Gitea 包来处理请求,因此其他包(models、modules 或 services)不能依赖于 routers。
|
||||
- `routers/api`:包含`/api/v1`相关路由,用于处理 RESTful API 请求。
|
||||
- `routers/install`:只能在系统处于安装模式(INSTALL_LOCK=false)时响应。
|
||||
- `routers/private`:仅由内部子命令调用,特别是`serv`和`hooks`。
|
||||
- `routers/web`:处理来自Web浏览器或Git SMART HTTP协议的HTTP请求。
|
||||
- `routers/web`:处理来自 Web 浏览器或 Git SMART HTTP 协议的 HTTP 请求。
|
||||
- `services`:用于常见路由操作或命令执行的支持函数。使用`models`和`modules`来处理请求。
|
||||
- `templates`:用于生成HTML输出的Golang模板。
|
||||
- `templates`:用于生成 HTML 输出的 Golang 模板。
|
||||
|
||||
### 包依赖关系
|
||||
|
||||
由于Golang不支持导入循环,我们必须仔细决定包之间的依赖关系。这些包之间有一些级别。以下是理想的包依赖关系方向。
|
||||
由于 Golang 不支持导入循环,我们必须仔细决定包之间的依赖关系。这些包之间有一些级别。以下是理想的包依赖关系方向。
|
||||
|
||||
`cmd` -> `routers` -> `services` -> `models` -> `modules`
|
||||
|
||||
@@ -88,18 +88,18 @@ func UpdateIssue(ctx context.Context, repoID int64) error {
|
||||
|
||||
### 导入别名
|
||||
|
||||
由于有一些使用相同包名的包,例如`modules/user`、`models/user`和`services/user`,当这些包在一个Go文件中被导入时,很难知道我们使用的是哪个包以及它是变量名还是导入名。因此,我们始终建议使用导入别名。为了与常见的驼峰命名法的包变量区分开,建议使用**snake_case**作为导入别名的命名规则。
|
||||
由于有一些使用相同包名的包,例如`modules/user`、`models/user`和`services/user`,当这些包在一个 Go 文件中被导入时,很难知道我们使用的是哪个包以及它是变量名还是导入名。因此,我们始终建议使用导入别名。为了与常见的驼峰命名法的包变量区分开,建议使用**snake_case**作为导入别名的命名规则。
|
||||
例如:`import user_service "code.gitea.io/gitea/services/user"`
|
||||
|
||||
### 重要注意事项
|
||||
|
||||
- 永远不要写成`x.Update(exemplar)`,而没有明确的`WHERE`子句:
|
||||
- 这将导致表中的所有行都被使用exemplar的非零值进行更新,包括ID。
|
||||
- 这将导致表中的所有行都被使用 exemplar 的非零值进行更新,包括 ID。
|
||||
- 通常应该写成`x.ID(id).Update(exemplar)`。
|
||||
- 如果在迁移过程中使用`x.Insert(exemplar)`向表中插入记录,而ID是预设的:
|
||||
- 对于MSSQL变体,你将需要执行``SET IDENTITY_INSERT `table` ON``(否则迁移将失败)
|
||||
- 对于PostgreSQL,你还需要更新ID序列,否则迁移将悄无声息地通过,但后续的插入将失败:
|
||||
``SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false)``
|
||||
- 如果在迁移过程中使用`x.Insert(exemplar)`向表中插入记录,而 ID 是预设的:
|
||||
- 对于 MSSQL 变体,你将需要执行`` SET IDENTITY_INSERT `table` ON ``(否则迁移将失败)
|
||||
- 对于 PostgreSQL,你还需要更新 ID 序列,否则迁移将悄无声息地通过,但后续的插入将失败:
|
||||
`` SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false) ``
|
||||
|
||||
### 未来的任务
|
||||
|
||||
|
||||
+38
-28
@@ -16,10 +16,10 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
|
||||
|
||||
源文件可以在以下目录中找到:
|
||||
|
||||
* **CSS 样式**: `web_src/css/`
|
||||
* **JavaScript 文件**: `web_src/js/`
|
||||
* **Vue 组件**: `web_src/js/components/`
|
||||
* **Go HTML 模板**: `templates/`
|
||||
- **CSS 样式**: `web_src/css/`
|
||||
- **JavaScript 文件**: `web_src/js/`
|
||||
- **Vue 组件**: `web_src/js/components/`
|
||||
- **Go HTML 模板**: `templates/`
|
||||
|
||||
## 通用准则
|
||||
|
||||
@@ -28,9 +28,9 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
|
||||
## Gitea 特定准则
|
||||
|
||||
1. 每个功能(Fomantic-UI/jQuery 模块)应放在单独的文件/目录中。
|
||||
2. HTML 的 id 和 class 应使用 kebab-case,最好包含2-3个与功能相关的关键词。
|
||||
3. 在 JavaScript 中使用的 HTML 的 id 和 class 应在整个项目中是唯一的,并且应包含2-3个与功能相关的关键词。建议在仅在 JavaScript 中使用的 class 中使用 `js-` 前缀。
|
||||
4. 不应覆盖框架提供的 class 的 CSS 样式。始终使用具有2-3个与功能相关的关键词的新 class 名称来覆盖框架样式。Gitea 中的帮助 CSS 类在 `helpers.less` 中。
|
||||
2. HTML 的 id 和 class 应使用 kebab-case,最好包含 2-3 个与功能相关的关键词。
|
||||
3. 在 JavaScript 中使用的 HTML 的 id 和 class 应在整个项目中是唯一的,并且应包含 2-3 个与功能相关的关键词。建议在仅在 JavaScript 中使用的 class 中使用 `js-` 前缀。
|
||||
4. 不应覆盖框架提供的 class 的 CSS 样式。始终使用具有 2-3 个与功能相关的关键词的新 class 名称来覆盖框架样式。Gitea 中的帮助 CSS 类在 `helpers.less` 中。
|
||||
5. 后端可以通过使用`ctx.PageData["myModuleData"] = map[]{}`将复杂数据传递给前端,但不要将整个模型暴露给前端,以避免泄露敏感数据。
|
||||
6. 简单页面和与 SEO 相关的页面使用 Go HTML 模板渲染生成静态的 Fomantic-UI HTML 输出。复杂页面可以使用 Vue3。
|
||||
7. 明确变量类型,优先使用`elem.disabled = true`而不是`elem.setAttribute('disabled', 'anything')`,优先使用`$el.prop('checked', var === 'yes')`而不是`$el.prop('checked', var)`。
|
||||
@@ -39,11 +39,11 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
|
||||
10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。
|
||||
11. 推荐使用自定义事件名称前缀`ce-`。
|
||||
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-ellipsis`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
|
||||
13. 尽量避免内联脚本和样式,建议将JS代码放入JS文件中并使用CSS类。如果内联脚本和样式不可避免,请解释无法避免的原因。
|
||||
13. 尽量避免内联脚本和样式,建议将 JS 代码放入 JS 文件中并使用 CSS 类。如果内联脚本和样式不可避免,请解释无法避免的原因。
|
||||
|
||||
### 可访问性 / ARIA
|
||||
|
||||
在历史上,Gitea大量使用了可访问性不友好的框架 Fomantic UI。
|
||||
在历史上,Gitea 大量使用了可访问性不友好的框架 Fomantic UI。
|
||||
Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`),
|
||||
但仍然存在许多问题需要大量的工作和时间来修复。
|
||||
|
||||
@@ -54,16 +54,16 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
|
||||
|
||||
推荐的实现方式:
|
||||
|
||||
* Vue + Vanilla JS
|
||||
* Fomantic-UI(jQuery)
|
||||
* htmx (部分页面重新加载其他静态组件)
|
||||
* Vanilla JS
|
||||
- Vue + Vanilla JS
|
||||
- Fomantic-UI(jQuery)
|
||||
- htmx (部分页面重新加载其他静态组件)
|
||||
- Vanilla JS
|
||||
|
||||
不推荐的实现方式:
|
||||
|
||||
* Vue + Fomantic-UI(jQuery)
|
||||
* jQuery + Vanilla JS
|
||||
* htmx + 任何其他需要大量 JavaScript 代码或不必要的功能,如 htmx 脚本 (`hx-on`)
|
||||
- Vue + Fomantic-UI(jQuery)
|
||||
- jQuery + Vanilla JS
|
||||
- htmx + 任何其他需要大量 JavaScript 代码或不必要的功能,如 htmx 脚本 (`hx-on`)
|
||||
|
||||
为了保持界面一致,Vue 组件可以使用 Fomantic-UI 的 CSS 类。
|
||||
尽管不建议混合使用不同的框架,
|
||||
@@ -83,7 +83,7 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
|
||||
|
||||
如果我们想在非异步上下文中调用`async`函数,
|
||||
建议使用`const _promise = asyncFoo()`来告诉读者
|
||||
这是有意为之的,我们想调用异步函数并忽略Promise。
|
||||
这是有意为之的,我们想调用异步函数并忽略 Promise。
|
||||
一些 lint 规则和 IDE 也会在未处理返回的 Promise 时发出警告。
|
||||
|
||||
### 获取数据
|
||||
@@ -97,31 +97,41 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
|
||||
禁止使用`dataset`,它的驼峰命名行为使得搜索属性变得困难。
|
||||
然而,仍然存在一些特殊情况,因此当前的准则是:
|
||||
|
||||
* 对于旧代码:
|
||||
* 应将`$.data()`重构为`$.attr()`。
|
||||
* 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
|
||||
- 对于旧代码:
|
||||
|
||||
* 对于新代码:
|
||||
* 不应使用`node.dataset`,而应使用`node.getAttribute`。
|
||||
* 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
|
||||
- 应将`$.data()`重构为`$.attr()`。
|
||||
- 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
|
||||
|
||||
- 对于新代码:
|
||||
- 不应使用`node.dataset`,而应使用`node.getAttribute`。
|
||||
- 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
|
||||
|
||||
### 显示/隐藏元素
|
||||
|
||||
* 推荐在Vue组件中使用`v-if`和`v-show`来显示/隐藏元素。
|
||||
* Go 模板代码应使用 `.tw-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
|
||||
- 推荐在 Vue 组件中使用`v-if`和`v-show`来显示/隐藏元素。
|
||||
- Go 模板代码应使用 `.tw-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.tw-hidden`的注释以获取更多详细信息。
|
||||
|
||||
### Go HTML 模板中的样式和属性
|
||||
|
||||
建议使用以下方式:
|
||||
|
||||
```html
|
||||
<div class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}" {{if .IsFoo}}data-foo{{end}}></div>
|
||||
<div
|
||||
class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}"
|
||||
{{if
|
||||
.IsFoo}}data-foo{{end}}
|
||||
></div>
|
||||
```
|
||||
|
||||
而不是:
|
||||
|
||||
```html
|
||||
<div class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"{{if .IsFoo}} data-foo{{end}}></div>
|
||||
<div
|
||||
class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"
|
||||
{{if
|
||||
.IsFoo}}
|
||||
data-foo{{end}}
|
||||
></div>
|
||||
```
|
||||
|
||||
以使代码更易读。
|
||||
@@ -134,6 +144,6 @@ Gitea 使用一些补丁使 Fomantic UI 更具可访问性(参见 `aria.md`)
|
||||
|
||||
Gitea 现在正在使用 Vue3。我们决定不引入 JSX,以保持 HTML 代码和 JavaScript 代码分离。
|
||||
|
||||
### UI示例
|
||||
### UI 示例
|
||||
|
||||
Gitea 使用一些自制的 UI 元素并自定义其他元素,以将它们更好地集成到通用 UI 方法中。当在开发模式(`RUN_MODE=dev`)下运行 Gitea 时,在 `http(s)://your-gitea-url:port/devtest` 下会提供一个包含一些标准化 UI 示例的页面。
|
||||
+18
-18
@@ -10,31 +10,31 @@ aliases:
|
||||
|
||||
## 背景
|
||||
|
||||
自2014年2月12日编写了第一行代码以来,Gitea已经发展成为一个庞大的项目。
|
||||
自 2014 年 2 月 12 日编写了第一行代码以来,Gitea 已经发展成为一个庞大的项目。
|
||||
因此,代码库变得越来越大。代码库越大,维护就越困难。
|
||||
存在许多过时的机制,许多框架混合在一起,一些遗留代码可能会导致错误并阻碍新功能的开发。
|
||||
为了使代码库更易于维护,使Gitea变得更好,开发人员应牢记使用现代机制来重构旧代码。
|
||||
为了使代码库更易于维护,使 Gitea 变得更好,开发人员应牢记使用现代机制来重构旧代码。
|
||||
|
||||
本文档是关于重构代码库的指南集合。
|
||||
|
||||
## 重构建议
|
||||
|
||||
* 设计更多关于未来的内容,而不仅仅解决当前问题。
|
||||
* 减少模糊性,减少冲突,提高可维护性。
|
||||
* 描述重构,例如:
|
||||
* 为什么需要重构。
|
||||
* 如何解决旧问题。
|
||||
* 重构的优点/缺点是什么。
|
||||
* 只做必要的更改,尽量保留旧逻辑。
|
||||
* 引入一些中间步骤,使重构更容易审查,完整的重构计划可以在几个PR中完成。
|
||||
* 如果存在分歧,应该请TOC(技术监督委员会)参与决策。
|
||||
* 添加必要的测试以确保重构的正确性。
|
||||
* 非错误重构优先在里程碑的开始时进行,这样可以更容易地在发布之前发现问题。
|
||||
- 设计更多关于未来的内容,而不仅仅解决当前问题。
|
||||
- 减少模糊性,减少冲突,提高可维护性。
|
||||
- 描述重构,例如:
|
||||
- 为什么需要重构。
|
||||
- 如何解决旧问题。
|
||||
- 重构的优点/缺点是什么。
|
||||
- 只做必要的更改,尽量保留旧逻辑。
|
||||
- 引入一些中间步骤,使重构更容易审查,完整的重构计划可以在几个 PR 中完成。
|
||||
- 如果存在分歧,应该请 TOC(技术监督委员会)参与决策。
|
||||
- 添加必要的测试以确保重构的正确性。
|
||||
- 非错误重构优先在里程碑的开始时进行,这样可以更容易地在发布之前发现问题。
|
||||
|
||||
## 审查和合并建议
|
||||
|
||||
* 重构的PR不应该长时间保持打开状态(通常为7天),应尽快进行审查。
|
||||
* 重构的PR应尽快合并,不应被其他PR阻塞。
|
||||
* 如果TOC没有异议,重构的PR可以在7天后由一名核心成员(非作者)批准后合并。
|
||||
* 如果最终结果良好,容忍一些不完美/临时的步骤。
|
||||
* 如果重构是必要的,容忍一些回归错误,并尽快修复错误。
|
||||
- 重构的 PR 不应该长时间保持打开状态(通常为 7 天),应尽快进行审查。
|
||||
- 重构的 PR 应尽快合并,不应被其他 PR 阻塞。
|
||||
- 如果 TOC 没有异议,重构的 PR 可以在 7 天后由一名核心成员(非作者)批准后合并。
|
||||
- 如果最终结果良好,容忍一些不完美/临时的步骤。
|
||||
- 如果重构是必要的,容忍一些回归错误,并尽快修复错误。
|
||||
@@ -8,9 +8,9 @@ aliases:
|
||||
|
||||
# 本地化
|
||||
|
||||
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
|
||||
Gitea 的本地化是通过我们的[Crowdin 项目](https://crowdin.com/project/gitea)进行的。
|
||||
|
||||
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)中合适的关键字。
|
||||
对于对**英语翻译**的更改,可以发出 pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)中合适的关键字。
|
||||
|
||||
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ aliases:
|
||||
|
||||
## 安装 Golang
|
||||
|
||||
您需要 [安装 go]( https://go.dev/doc/install ) 并设置您的 go 环境。
|
||||
您需要 [安装 go](https://go.dev/doc/install) 并设置您的 go 环境。
|
||||
|
||||
接下来,[使用 npm 安装 Node.js](https://nodejs.org/en/download/) ,这是构建
|
||||
JavaScript 和 CSS 文件的必要工具。最低支持的 Node.js 版本是 @minNodeVersion@
|
||||
@@ -24,12 +24,12 @@ JavaScript 和 CSS 文件的必要工具。最低支持的 Node.js 版本是 @mi
|
||||
|
||||
**注意** :当执行需要外部工具的 make 任务时,比如
|
||||
`make watch-backend`,Gitea 会自动下载并构建这些必要的组件。为了能够使用这些,你必须
|
||||
将 `"$GOPATH"/bin` 目录加入到可执行路径上。如果你不把go bin目录添加到可执行路径你必须手动
|
||||
将 `"$GOPATH"/bin` 目录加入到可执行路径上。如果你不把 go bin 目录添加到可执行路径你必须手动
|
||||
指定可执行程序路径。
|
||||
|
||||
**注意2** :Go版本 @minGoVersion@ 或更高版本是必须的。Gitea 使用 `gofmt` 来
|
||||
**注意 2** :Go 版本 @minGoVersion@ 或更高版本是必须的。Gitea 使用 `gofmt` 来
|
||||
格式化源代码。然而,`gofmt` 的结果可能因 `go` 的版本而有差异。因此推荐安装我们持续集成使用
|
||||
的 Go版本。截至上次更新,Go 版本应该是 @goVersion@。
|
||||
的 Go 版本。截至上次更新,Go 版本应该是 @goVersion@。
|
||||
|
||||
## 安装 Make
|
||||
|
||||
@@ -55,15 +55,15 @@ sudo yum install make
|
||||
|
||||
Make 的这三个发行版都可以在 Windows 上运行:
|
||||
|
||||
- [单个二进制构建]( http://www.equation.com/servlet/equation.cmd?fa=make )。复制到某处并添加到 `PATH`。
|
||||
- [单个二进制构建](http://www.equation.com/servlet/equation.cmd?fa=make)。复制到某处并添加到 `PATH`。
|
||||
- [32 位版本](http://www.equation.com/ftpdir/make/32/make.exe)
|
||||
- [64 位版本](http://www.equation.com/ftpdir/make/64/make.exe)
|
||||
- [MinGW-w64](https://www.mingw-w64.org) / [MSYS2](https://www.msys2.org/)。
|
||||
- MSYS2 是一个工具和库的集合,为您提供一个易于使用的环境来构建、安装和运行本机 Windows 软件,它包括 MinGW-w64。
|
||||
- 在 MingGW-w64 中,二进制文件称为 `mingw32-make.exe` 而不是 `make.exe`。将 `bin` 文件夹添加到 `PATH`。
|
||||
- 在 MSYS2 中,您可以直接使用 `make`。请参阅 [MSYS2 移植](https://www.msys2.org/wiki/Porting/)。
|
||||
- 要使用 CGO_ENABLED(例如:SQLite3)编译 Gitea,您可能需要使用 [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) 而不是 MSYS2 gcc,因为 MSYS2 gcc 标头缺少一些 Windows -只有 CRT 函数像 _beginthread 一样。
|
||||
- [Chocolatey包管理器]( https://chocolatey.org/packages/make )。运行`choco install make`
|
||||
- 要使用 CGO_ENABLED(例如:SQLite3)编译 Gitea,您可能需要使用 [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) 而不是 MSYS2 gcc,因为 MSYS2 gcc 标头缺少一些 Windows -只有 CRT 函数像 \_beginthread 一样。
|
||||
- [Chocolatey 包管理器](https://chocolatey.org/packages/make)。运行`choco install make`
|
||||
|
||||
**注意** :如果您尝试在 Windows 命令提示符下使用 make 进行构建,您可能会遇到问题。建议使用上述提示(Git bash 或 MinGW),但是如果您只有命令提示符(或可能是 PowerShell),则可以使用 [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) 命令,例如 `set TAGS=bindata`。
|
||||
|
||||
@@ -75,7 +75,7 @@ Make 的这三个发行版都可以在 Windows 上运行:
|
||||
git clone https://github.com/go-gitea/gitea
|
||||
```
|
||||
|
||||
(自从go modules出现后,不再需要构建 go 项目从 `$GOPATH` 中获取,因此不再推荐使用 `go get` 方法。)
|
||||
(自从 go modules 出现后,不再需要构建 go 项目从 `$GOPATH` 中获取,因此不再推荐使用 `go get` 方法。)
|
||||
|
||||
## 派生 Gitea
|
||||
|
||||
@@ -196,7 +196,7 @@ SVG 图标是使用 `make svg` 命令构建的,该命令将图标资源编译
|
||||
|
||||
### 构建 Logo
|
||||
|
||||
Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images` 目标从单个 SVG 源文件 assets/logo.svg 构建的。要运行它,Node.js 和 npm 必须可用。
|
||||
Gitea Logo 的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images` 目标从单个 SVG 源文件 assets/logo.svg 构建的。要运行它,Node.js 和 npm 必须可用。
|
||||
|
||||
通过更新 `assets/logo.svg` 并运行 `make generate-images`,同样的过程也可用于从 SVG 源文件生成自定义 Logo PNG。忽略 gitea 编译选项将仅更新用户指定的 LOGO 文件。
|
||||
|
||||
@@ -205,7 +205,7 @@ Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images`
|
||||
创建新的 API 路由或修改现有的 API 路由时,您**必须**
|
||||
更新和/或创建 [Swagger](https://swagger.io/docs/specification/2-0/what-is-swagger/)
|
||||
这些使用 [go-swagger](https://goswagger.io/) 评论的文档。
|
||||
[规范]( https://goswagger.io/use/spec.html#annotation-syntax )中描述了这些注释的结构。
|
||||
[规范](https://goswagger.io/use/spec.html#annotation-syntax)中描述了这些注释的结构。
|
||||
如果您想了解更多有关 Swagger 结构的信息,可以查看
|
||||
[Swagger 2.0 文档](https://swagger.io/docs/specification/2-0/basic-structure/)
|
||||
或与添加新 API 端点的先前 PR 进行比较,例如 [PR #5483](https://github.com/go-gitea/gitea/pull/5843/files#diff-2e0a7b644cf31e1c8ef7d76b444fe3aaR20)
|
||||
@@ -239,7 +239,7 @@ make swagger-check
|
||||
并到[配置备忘单](../administration/config-cheat-sheet.md)
|
||||
在 `docs/content/doc/advanced/config-cheat-sheet.zh-cn.md` 中找到
|
||||
|
||||
### 更改Logo
|
||||
### 更改 Logo
|
||||
|
||||
更改 Gitea Logo SVG 时,您将需要运行并提交结果的:
|
||||
|
||||
@@ -291,7 +291,7 @@ TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
|
||||
我们的持续集成将测试代码是否通过了单元测试,并且所有支持的数据库都将在 Docker 环境中通过集成测试。
|
||||
还将测试从几个最新版本的 Gitea 迁移。
|
||||
|
||||
请在PR中附带提交适当的单元测试和集成测试。
|
||||
请在 PR 中附带提交适当的单元测试和集成测试。
|
||||
|
||||
## 网站文档
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ aliases:
|
||||
|
||||
# 集成
|
||||
|
||||
Gitea拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
|
||||
Gitea 拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
|
||||
|
||||
我们正在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)上整理一个列表来跟踪这些集成!
|
||||
|
||||
|
||||
@@ -8,24 +8,24 @@ aliases:
|
||||
|
||||
# 迁移接口
|
||||
|
||||
完整迁移功能在Gitea 1.9.0版本中引入。它定义了两个接口,用于支持从其他Git托管平台迁移存储库数据到Gitea,或者在将来将Gitea数据迁移到其他Git托管平台。
|
||||
完整迁移功能在 Gitea 1.9.0 版本中引入。它定义了两个接口,用于支持从其他 Git 托管平台迁移存储库数据到 Gitea,或者在将来将 Gitea 数据迁移到其他 Git 托管平台。
|
||||
|
||||
目前已实现了从GitHub、GitLab和其他Gitea实例的迁移。
|
||||
目前已实现了从 GitHub、GitLab 和其他 Gitea 实例的迁移。
|
||||
|
||||
首先,Gitea在包[modules/migration](https://github.com/go-gitea/gitea/tree/main/modules/migration)中定义了一些标准对象。它们是`Repository`、`Milestone`、`Release`、`ReleaseAsset`、`Label`、`Issue`、`Comment`、`PullRequest`、`Reaction`、`Review`、`ReviewComment`。
|
||||
首先,Gitea 在包[modules/migration](https://github.com/go-gitea/gitea/tree/main/modules/migration)中定义了一些标准对象。它们是`Repository`、`Milestone`、`Release`、`ReleaseAsset`、`Label`、`Issue`、`Comment`、`PullRequest`、`Reaction`、`Review`、`ReviewComment`。
|
||||
|
||||
## 下载器接口
|
||||
|
||||
要从新的Git托管平台迁移,需要进行两个步骤的更新。
|
||||
要从新的 Git 托管平台迁移,需要进行两个步骤的更新。
|
||||
|
||||
- 您应该实现一个`Downloader`,用于获取存储库信息。
|
||||
- 您应该实现一个`DownloaderFactory`,用于检测URL是否匹配,并创建上述的`Downloader`。
|
||||
- 您应该实现一个`DownloaderFactory`,用于检测 URL 是否匹配,并创建上述的`Downloader`。
|
||||
- 您需要在`init()`中通过`RegisterDownloaderFactory`注册`DownloaderFactory`。
|
||||
|
||||
您可以在[downloader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/downloader.go)中找到这些接口。
|
||||
|
||||
## 上传器接口
|
||||
|
||||
目前,只实现了`GiteaLocalUploader`,因此我们只能通过此Uploader将下载的数据保存到本地的Gitea实例。目前不支持其他上传器。
|
||||
目前,只实现了`GiteaLocalUploader`,因此我们只能通过此 Uploader 将下载的数据保存到本地的 Gitea 实例。目前不支持其他上传器。
|
||||
|
||||
您可以在[uploader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/uploader.go)中找到这些接口。
|
||||
Loaded 50 of 1197 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user