Reformat docs (#13897)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
tokarchuk/v1.17
Patrick Schratz 4 years ago committed by GitHub
parent 97ab820acc
commit af79677a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      docs/content/doc/advanced/cmd-embedded.en-us.md
  2. 44
      docs/content/doc/advanced/customizing-gitea.en-us.md
  3. 42
      docs/content/doc/advanced/environment-variables.en-us.md
  4. 16
      docs/content/doc/advanced/external-renderers.en-us.md
  5. 142
      docs/content/doc/advanced/logging-documentation.en-us.md
  6. 50
      docs/content/doc/advanced/mail-templates-us.md
  7. 2
      docs/content/doc/advanced/make.fr-fr.md
  8. 2
      docs/content/doc/advanced/make.zh-cn.md
  9. 22
      docs/content/doc/advanced/repo-indexer.en-us.md
  10. 2
      docs/content/doc/advanced/search-engines-indexation.en-us.md
  11. 66
      docs/content/doc/advanced/signing.en-us.md
  12. 2
      docs/content/doc/advanced/third-party-tools.zh-cn.md
  13. 17
      docs/content/doc/developers/api-usage.en-us.md
  14. 2
      docs/content/doc/developers/api-usage.zh-cn.md
  15. 6
      docs/content/doc/developers/hacking-on-gitea.en-us.md
  16. 2
      docs/content/doc/developers/integrations.en-us.md
  17. 2
      docs/content/doc/developers/migrations.en-us.md
  18. 20
      docs/content/doc/developers/oauth2-provider.md
  19. 86
      docs/content/doc/features/authentication.en-us.md
  20. 2
      docs/content/doc/features/authentication.zh-cn.md
  21. 2
      docs/content/doc/features/authentication.zh-tw.md
  22. 33
      docs/content/doc/features/comparison.en-us.md
  23. 2
      docs/content/doc/features/comparison.zh-cn.md
  24. 2
      docs/content/doc/features/localization.en-us.md
  25. 2
      docs/content/doc/features/localization.zh-cn.md
  26. 2
      docs/content/doc/features/localization.zh-tw.md
  27. 2
      docs/content/doc/features/webhooks.en-us.md
  28. 2
      docs/content/doc/features/webhooks.zh-cn.md
  29. 2
      docs/content/doc/features/webhooks.zh-tw.md
  30. 128
      docs/content/doc/help/faq.en-us.md
  31. 2
      docs/content/doc/help/search.en-us.md
  32. 2
      docs/content/doc/help/search.fr-fr.md
  33. 2
      docs/content/doc/help/search.zh-cn.md
  34. 2
      docs/content/doc/help/search.zh-tw.md
  35. 2
      docs/content/doc/help/seek-help.en-us.md
  36. 2
      docs/content/doc/help/seek-help.zh-cn.md
  37. 9
      docs/content/doc/installation/database-preparation.en-us.md
  38. 4
      docs/content/doc/installation/from-binary.en-us.md
  39. 2
      docs/content/doc/installation/from-binary.fr-fr.md
  40. 2
      docs/content/doc/installation/from-binary.zh-cn.md
  41. 2
      docs/content/doc/installation/from-binary.zh-tw.md
  42. 5
      docs/content/doc/installation/from-package.en-us.md
  43. 2
      docs/content/doc/installation/from-package.fr-fr.md
  44. 2
      docs/content/doc/installation/from-package.zh-cn.md
  45. 2
      docs/content/doc/installation/from-package.zh-tw.md
  46. 20
      docs/content/doc/installation/from-source.en-us.md
  47. 2
      docs/content/doc/installation/from-source.fr-fr.md
  48. 2
      docs/content/doc/installation/from-source.zh-cn.md
  49. 2
      docs/content/doc/installation/from-source.zh-tw.md
  50. 2
      docs/content/doc/installation/on-kubernetes.en-us.md
  51. 2
      docs/content/doc/installation/run-as-service-in-ubuntu.en-us.md
  52. 2
      docs/content/doc/installation/run-as-service-in-ubuntu.zh-cn.md
  53. 2
      docs/content/doc/installation/windows-service.en-us.md
  54. 2
      docs/content/doc/installation/windows-service.fr-fr.md
  55. 2
      docs/content/doc/installation/windows-service.zh-cn.md
  56. 2
      docs/content/doc/installation/windows-service.zh-tw.md
  57. 2
      docs/content/doc/installation/with-docker-rootless.en-us.md
  58. 68
      docs/content/doc/installation/with-docker.en-us.md
  59. 2
      docs/content/doc/installation/with-docker.fr-fr.md
  60. 2
      docs/content/doc/installation/with-docker.zh-cn.md
  61. 2
      docs/content/doc/installation/with-docker.zh-tw.md
  62. 6
      docs/content/doc/upgrade/from-gogs.en-us.md
  63. 2
      docs/content/doc/upgrade/from-gogs.fr-fr.md
  64. 2
      docs/content/doc/upgrade/from-gogs.zh-cn.md
  65. 2
      docs/content/doc/upgrade/from-gogs.zh-tw.md
  66. 22
      docs/content/doc/usage/backup-and-restore.en-us.md
  67. 2
      docs/content/doc/usage/backup-and-restore.zh-cn.md
  68. 2
      docs/content/doc/usage/backup-and-restore.zh-tw.md
  69. 27
      docs/content/doc/usage/command-line.en-us.md
  70. 9
      docs/content/doc/usage/email-setup.en-us.md
  71. 2
      docs/content/doc/usage/fail2ban-setup.en-us.md
  72. 2
      docs/content/doc/usage/git-lfs-support.md
  73. 15
      docs/content/doc/usage/https-support.md
  74. 60
      docs/content/doc/usage/issue-pull-request-templates.en-us.md
  75. 2
      docs/content/doc/usage/issue-pull-request-templates.zh-cn.md
  76. 30
      docs/content/doc/usage/linked-references.en-us.md
  77. 4
      docs/content/doc/usage/pull-request.en-us.md
  78. 2
      docs/content/doc/usage/pull-request.zh-cn.md
  79. 2
      docs/content/doc/usage/push-options.en-us.md
  80. 29
      docs/content/doc/usage/reverse-proxies.en-us.md
  81. 2
      docs/content/doc/usage/reverse-proxies.zh-cn.md
  82. 24
      docs/content/doc/usage/template-repositories.md
  83. 2
      docs/content/page/index.en-us.md
  84. 2
      docs/content/page/index.fr-fr.md
  85. 2
      docs/content/page/index.zh-cn.md
  86. 2
      docs/content/page/index.zh-tw.md

@ -3,7 +3,7 @@ date: "2020-01-25T21:00:00-03:00"
title: "Embedded data extraction tool" title: "Embedded data extraction tool"
slug: "cmd-embedded" slug: "cmd-embedded"
weight: 40 weight: 40
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,10 @@ menu:
# Embedded data extraction tool # Embedded data extraction tool
**Table of Contents**
{{< toc >}}
Gitea's executable contains all the resources required to run: templates, images, style-sheets Gitea's executable contains all the resources required to run: templates, images, style-sheets
and translations. Any of them can be overridden by placing a replacement in a matching path and translations. Any of them can be overridden by placing a replacement in a matching path
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})). inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})).
@ -28,7 +32,7 @@ can be used from the OS shell interface.
To list resources embedded in Gitea's executable, use the following syntax: To list resources embedded in Gitea's executable, use the following syntax:
``` ```sh
gitea embedded list [--include-vendored] [patterns...] gitea embedded list [--include-vendored] [patterns...]
``` ```
@ -48,11 +52,11 @@ a special meaning for your command shell.
If no pattern is provided, all files are listed. If no pattern is provided, all files are listed.
#### Example ### Example
Listing all embedded files with `openid` in their path: Listing all embedded files with `openid` in their path:
``` ```sh
$ gitea embedded list '**openid**' $ gitea embedded list '**openid**'
public/img/auth/openid_connect.svg public/img/auth/openid_connect.svg
public/img/openid-16x16.png public/img/openid-16x16.png
@ -68,7 +72,7 @@ templates/user/settings/security_openid.tmpl
To extract resources embedded in Gitea's executable, use the following syntax: To extract resources embedded in Gitea's executable, use the following syntax:
``` ```sh
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...} gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
``` ```
@ -91,7 +95,7 @@ as `filename.bak`. Previous `.bak` files are overwritten.
At least one file search pattern must be provided; see `list` subcomand above for pattern At least one file search pattern must be provided; see `list` subcomand above for pattern
syntax and examples. syntax and examples.
#### Important notice ### Important notice
Make sure to **only extract those files that require customization**. Files that Make sure to **only extract those files that require customization**. Files that
are present in the `custom` directory are not upgraded by Gitea's upgrade process. are present in the `custom` directory are not upgraded by Gitea's upgrade process.
@ -99,11 +103,11 @@ When Gitea is upgraded to a new version (by replacing the executable), many of t
embedded files will suffer changes. Gitea will honor and use any files found embedded files will suffer changes. Gitea will honor and use any files found
in the `custom` directory, even if they are old and incompatible. in the `custom` directory, even if they are old and incompatible.
#### Example ### Example
Extracting mail templates to a temporary directory: Extracting mail templates to a temporary directory:
``` ```sh
$ mkdir tempdir $ mkdir tempdir
$ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl' $ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl'
Extracting to tempdir: Extracting to tempdir:

@ -45,7 +45,7 @@ environment variable; this can be used to override the default path to something
**Note:** Gitea must perform a full restart to see configuration changes. **Note:** Gitea must perform a full restart to see configuration changes.
# Table of Contents **Table of Contents**
{{< toc >}} {{< toc >}}
@ -128,7 +128,7 @@ copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highl
<script src="https://your-server.com/plantuml_codeblock_parse.js"></script> <script src="https://your-server.com/plantuml_codeblock_parse.js"></script>
<script> <script>
<!-- Replace call with address to your plantuml server--> <!-- Replace call with address to your plantuml server-->
parsePlantumlCodeBlocks("http://www.plantuml..com/plantuml") parsePlantumlCodeBlocks("http://www.plantuml..com/plantuml");
</script> </script>
{{end}} {{end}}
``` ```
@ -148,38 +148,50 @@ The script will detect tags with `class="language-plantuml"`, but you can change
#### Example: STL Preview #### Example: STL Preview
You can display STL file directly in Gitea by adding: You can display STL file directly in Gitea by adding:
```html ```html
<script> <script>
function lS(src) { function lS(src) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
let s = document.createElement('script') let s = document.createElement("script");
s.src = src s.src = src;
s.addEventListener('load', () => { s.addEventListener("load", () => {
resolve() resolve();
}) });
document.body.appendChild(s) document.body.appendChild(s);
}); });
} }
if ($('.view-raw>a[href$=".stl" i]').length) { if ($('.view-raw>a[href$=".stl" i]').length) {
$('body').append('<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">'); $("body").append(
Promise.all([lS("/Madeleine.js/src/lib/stats.js"),lS("/Madeleine.js/src/lib/detector.js"), lS("/Madeleine.js/src/lib/three.min.js"), lS("/Madeleine.js/src/Madeleine.js")]).then(function() { '<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">'
$('.view-raw').attr('id', 'view-raw').attr('style', 'padding: 0;margin-bottom: -10px;'); );
Promise.all([
lS("/Madeleine.js/src/lib/stats.js"),
lS("/Madeleine.js/src/lib/detector.js"),
lS("/Madeleine.js/src/lib/three.min.js"),
lS("/Madeleine.js/src/Madeleine.js"),
]).then(function () {
$(".view-raw")
.attr("id", "view-raw")
.attr("style", "padding: 0;margin-bottom: -10px;");
new Madeleine({ new Madeleine({
target: 'view-raw', target: "view-raw",
data: $('.view-raw>a[href$=".stl" i]').attr('href'), data: $('.view-raw>a[href$=".stl" i]').attr("href"),
path: '/Madeleine.js/src' path: "/Madeleine.js/src",
}); });
$('.view-raw>a[href$=".stl"]').remove() $('.view-raw>a[href$=".stl"]').remove();
}); });
} }
</script> </script>
``` ```
to the file `templates/custom/footer.tmpl` to the file `templates/custom/footer.tmpl`
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `custom/public/` folder. You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `custom/public/` folder.
You should end-up with a folder structucture similar to: You should end-up with a folder structucture similar to:
``` ```
custom/templates custom/templates
-- custom -- custom
@ -289,10 +301,12 @@ currently there are `{Name}` (name of repository), `{Description}`, `{CloneURL.S
### Reactions ### Reactions
To change reaction emoji's you can set allowed reactions at app.ini To change reaction emoji's you can set allowed reactions at app.ini
``` ```
[ui] [ui]
REACTIONS = +1, -1, laugh, confused, heart, hooray, eyes REACTIONS = +1, -1, laugh, confused, heart, hooray, eyes
``` ```
A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gitea.com/issues/8) A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gitea.com/issues/8)
## Customizing the look of Gitea ## Customizing the look of Gitea

@ -15,11 +15,15 @@ menu:
# Environment variables # Environment variables
**Table of Contents**
{{< toc >}}
This is an inventory of Gitea environment variables. They change Gitea behaviour. This is an inventory of Gitea environment variables. They change Gitea behaviour.
Initialize them before Gitea command to be effective, for example: Initialize them before Gitea command to be effective, for example:
``` ```sh
GITEA_CUSTOM=/home/gitea/custom ./gitea web GITEA_CUSTOM=/home/gitea/custom ./gitea web
``` ```
@ -27,42 +31,42 @@ GITEA_CUSTOM=/home/gitea/custom ./gitea web
As Gitea is written in Go, it uses some Go variables, such as: As Gitea is written in Go, it uses some Go variables, such as:
* `GOOS` - `GOOS`
* `GOARCH` - `GOARCH`
* [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable) - [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable)
For documentation about each of the variables available, refer to the For documentation about each of the variables available, refer to the
[official Go documentation](https://golang.org/cmd/go/#hdr-Environment_variables). [official Go documentation](https://golang.org/cmd/go/#hdr-Environment_variables).
## Gitea files ## Gitea files
* `GITEA_WORK_DIR`: Absolute path of working directory. - `GITEA_WORK_DIR`: Absolute path of working directory.
* `GITEA_CUSTOM`: Gitea uses `GITEA_WORK_DIR`/custom folder by default. Use this variable - `GITEA_CUSTOM`: Gitea uses `GITEA_WORK_DIR`/custom folder by default. Use this variable
to change *custom* directory. to change _custom_ directory.
* `GOGS_WORK_DIR`: Deprecated, use `GITEA_WORK_DIR` - `GOGS_WORK_DIR`: Deprecated, use `GITEA_WORK_DIR`
* `GOGS_CUSTOM`: Deprecated, use `GITEA_CUSTOM` - `GOGS_CUSTOM`: Deprecated, use `GITEA_CUSTOM`
## Operating system specifics ## Operating system specifics
* `USER`: System user that Gitea will run as. Used for some repository access strings. - `USER`: System user that Gitea will run as. Used for some repository access strings.
* `USERNAME`: if no `USER` found, Gitea will use `USERNAME` - `USERNAME`: if no `USER` found, Gitea will use `USERNAME`
* `HOME`: User home directory path. The `USERPROFILE` environment variable is used in Windows. - `HOME`: User home directory path. The `USERPROFILE` environment variable is used in Windows.
### Only on Windows ### Only on Windows
* `USERPROFILE`: User home directory path. If empty, uses `HOMEDRIVE` + `HOMEPATH` - `USERPROFILE`: User home directory path. If empty, uses `HOMEDRIVE` + `HOMEPATH`
* `HOMEDRIVE`: Main drive path used to access the home directory (C:) - `HOMEDRIVE`: Main drive path used to access the home directory (C:)
* `HOMEPATH`: Home relative path in the given home drive path - `HOMEPATH`: Home relative path in the given home drive path
## Macaron (framework used by Gitea) ## Macaron (framework used by Gitea)
* `HOST`: Host Macaron will listen on - `HOST`: Host Macaron will listen on
* `PORT`: Port Macaron will listen on - `PORT`: Port Macaron will listen on
* `MACARON_ENV`: global variable to provide special functionality for development environments - `MACARON_ENV`: global variable to provide special functionality for development environments
vs. production environments. If MACARON_ENV is set to "" or "development", then templates will vs. production environments. If MACARON_ENV is set to "" or "development", then templates will
be recompiled on every request. For more performance, set the MACARON_ENV environment variable be recompiled on every request. For more performance, set the MACARON_ENV environment variable
to "production". to "production".
## Miscellaneous ## Miscellaneous
* `SKIP_MINWINSVC`: If set to 1, do not run as a service on Windows. - `SKIP_MINWINSVC`: If set to 1, do not run as a service on Windows.

@ -3,7 +3,7 @@ date: "2018-11-23:00:00+02:00"
title: "External renderers" title: "External renderers"
slug: "external-renderers" slug: "external-renderers"
weight: 40 weight: 40
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,12 +15,16 @@ menu:
# Custom files rendering configuration # Custom files rendering configuration
**Table of Contents**
{{< toc >}}
Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries, Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries,
it is just a matter of: it is just a matter of:
* installing external binaries - installing external binaries
* add some configuration to your `app.ini` file - add some configuration to your `app.ini` file
* restart your Gitea instance - restart your Gitea instance
This supports rendering of whole files. If you want to render code blocks in markdown you would need to do something with javascript. See some examples on the [Customizing Gitea](../customizing-gitea) page. This supports rendering of whole files. If you want to render code blocks in markdown you would need to do something with javascript. See some examples on the [Customizing Gitea](../customizing-gitea) page.
@ -29,7 +33,7 @@ This supports rendering of whole files. If you want to render code blocks in mar
In order to get file rendering through external binaries, their associated packages must be installed. In order to get file rendering through external binaries, their associated packages must be installed.
If you're using a Docker image, your `Dockerfile` should contain something along this lines: If you're using a Docker image, your `Dockerfile` should contain something along this lines:
``` ```docker
FROM gitea/gitea:{{< version >}} FROM gitea/gitea:{{< version >}}
[...] [...]
@ -49,7 +53,7 @@ RUN pip3 install jupyter docutils
add one `[markup.XXXXX]` section per external renderer on your custom `app.ini`: add one `[markup.XXXXX]` section per external renderer on your custom `app.ini`:
``` ```ini
[markup.asciidoc] [markup.asciidoc]
ENABLED = true ENABLED = true
FILE_EXTENSIONS = .adoc,.asciidoc FILE_EXTENSIONS = .adoc,.asciidoc

@ -3,7 +3,7 @@ date: "2019-04-02T17:06:00+01:00"
title: "Advanced: Logging Configuration" title: "Advanced: Logging Configuration"
slug: "logging-configuration" slug: "logging-configuration"
weight: 55 weight: 55
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -17,6 +17,8 @@ menu:
The logging framework has been revamped in Gitea 1.9.0. The logging framework has been revamped in Gitea 1.9.0.
**Table of Contents**
{{< toc >}} {{< toc >}}
## Log Groups ## Log Groups
@ -24,11 +26,11 @@ The logging framework has been revamped in Gitea 1.9.0.
The fundamental thing to be aware of in Gitea is that there are several The fundamental thing to be aware of in Gitea is that there are several
log groups: log groups:
* The "Default" logger - The "Default" logger
* The Macaron logger - The Macaron logger
* The Router logger - The Router logger
* The Access logger - The Access logger
* The XORM logger - The XORM logger
There is also the go log logger. There is also the go log logger.
@ -55,11 +57,11 @@ which inherits from the sublogger `[log.sublogger]` section and from the
generic `[log]` section, but there are certain default values. These will generic `[log]` section, but there are certain default values. These will
not be inherited from the `[log]` section: not be inherited from the `[log]` section:
* `FLAGS` is `stdflags` (Equal to - `FLAGS` is `stdflags` (Equal to
`date,time,medfile,shortfuncname,levelinitial`) `date,time,medfile,shortfuncname,levelinitial`)
* `FILE_NAME` will default to `%(ROOT_PATH)/gitea.log` - `FILE_NAME` will default to `%(ROOT_PATH)/gitea.log`
* `EXPRESSION` will default to `""` - `EXPRESSION` will default to `""`
* `PREFIX` will default to `""` - `PREFIX` will default to `""`
The provider type of the sublogger can be set using the `MODE` value in The provider type of the sublogger can be set using the `MODE` value in
its subsection, but will default to the name. This allows you to have its subsection, but will default to the name. This allows you to have
@ -82,11 +84,11 @@ Each output sublogger for this logger is configured in
which will not be inherited from the `[log]` or relevant which will not be inherited from the `[log]` or relevant
`[log.sublogger]` sections: `[log.sublogger]` sections:
* `FLAGS` is `stdflags` (Equal to - `FLAGS` is `stdflags` (Equal to
`date,time,medfile,shortfuncname,levelinitial`) `date,time,medfile,shortfuncname,levelinitial`)
* `FILE_NAME` will default to `%(ROOT_PATH)/macaron.log` - `FILE_NAME` will default to `%(ROOT_PATH)/macaron.log`
* `EXPRESSION` will default to `""` - `EXPRESSION` will default to `""`
* `PREFIX` will default to `""` - `PREFIX` will default to `""`
NB: You can redirect the macaron logger to send its events to the gitea NB: You can redirect the macaron logger to send its events to the gitea
log using the value: `MACARON = ,` log using the value: `MACARON = ,`
@ -113,10 +115,10 @@ Each output sublogger for this logger is configured in
which will not be inherited from the `[log]` or relevant which will not be inherited from the `[log]` or relevant
`[log.sublogger]` sections: `[log.sublogger]` sections:
* `FILE_NAME` will default to `%(ROOT_PATH)/router.log` - `FILE_NAME` will default to `%(ROOT_PATH)/router.log`
* `FLAGS` defaults to `date,time` - `FLAGS` defaults to `date,time`
* `EXPRESSION` will default to `""` - `EXPRESSION` will default to `""`
* `PREFIX` will default to `""` - `PREFIX` will default to `""`
NB: You can redirect the router logger to send its events to the Gitea NB: You can redirect the router logger to send its events to the Gitea
log using the value: `ROUTER = ,` log using the value: `ROUTER = ,`
@ -138,10 +140,10 @@ Each output sublogger for this logger is configured in
which will not be inherited from the `[log]` or relevant which will not be inherited from the `[log]` or relevant
`[log.sublogger]` sections: `[log.sublogger]` sections:
* `FILE_NAME` will default to `%(ROOT_PATH)/access.log` - `FILE_NAME` will default to `%(ROOT_PATH)/access.log`
* `FLAGS` defaults to `` or None - `FLAGS` defaults to `` or None
* `EXPRESSION` will default to `""` - `EXPRESSION` will default to `""`
* `PREFIX` will default to `""` - `PREFIX` will default to `""`
If desired the format of the Access logger can be changed by changing If desired the format of the Access logger can be changed by changing
the value of the `ACCESS_LOG_TEMPLATE`. the value of the `ACCESS_LOG_TEMPLATE`.
@ -160,11 +162,11 @@ This value represent a go template. It's default value is:
The template is passed following options: The template is passed following options:
* `Ctx` is the `macaron.Context` - `Ctx` is the `macaron.Context`
* `Identity` is the `SignedUserName` or `"-"` if the user is not logged - `Identity` is the `SignedUserName` or `"-"` if the user is not logged
in in
* `Start` is the start time of the request - `Start` is the start time of the request
* `ResponseWriter` is the `macaron.ResponseWriter` - `ResponseWriter` is the `macaron.ResponseWriter`
Caution must be taken when changing this template as it runs outside of Caution must be taken when changing this template as it runs outside of
the standard panic recovery trap. The template should also be as simple the standard panic recovery trap. The template should also be as simple
@ -187,30 +189,30 @@ Each output sublogger for this logger is configured in
which will not be inherited from the `[log]` or relevant which will not be inherited from the `[log]` or relevant
`[log.sublogger]` sections: `[log.sublogger]` sections:
* `FILE_NAME` will default to `%(ROOT_PATH)/xorm.log` - `FILE_NAME` will default to `%(ROOT_PATH)/xorm.log`
* `FLAGS` defaults to `date,time` - `FLAGS` defaults to `date,time`
* `EXPRESSION` will default to `""` - `EXPRESSION` will default to `""`
* `PREFIX` will default to `""` - `PREFIX` will default to `""`
## Log outputs ## Log outputs
Gitea provides 4 possible log outputs: Gitea provides 4 possible log outputs:
* `console` - Log to `os.Stdout` or `os.Stderr` - `console` - Log to `os.Stdout` or `os.Stderr`
* `file` - Log to a file - `file` - Log to a file
* `conn` - Log to a keep-alive TCP connection - `conn` - Log to a keep-alive TCP connection
* `smtp` - Log via email - `smtp` - Log via email
Certain configuration is common to all modes of log output: Certain configuration is common to all modes of log output:
* `LEVEL` is the lowest level that this output will log. This value - `LEVEL` is the lowest level that this output will log. This value
is inherited from `[log]` and in the case of the non-default loggers is inherited from `[log]` and in the case of the non-default loggers
from `[log.sublogger]`. from `[log.sublogger]`.
* `STACKTRACE_LEVEL` is the lowest level that this output will print - `STACKTRACE_LEVEL` is the lowest level that this output will print
a stacktrace. This value is inherited. a stacktrace. This value is inherited.
* `MODE` is the mode of the log output. It will default to the sublogger - `MODE` is the mode of the log output. It will default to the sublogger
name. Thus `[log.console.macaron]` will default to `MODE = console`. name. Thus `[log.console.macaron]` will default to `MODE = console`.
* `COLORIZE` will default to `true` for `console` as - `COLORIZE` will default to `true` for `console` as
described, otherwise it will default to `false`. described, otherwise it will default to `false`.
### Non-inherited default values ### Non-inherited default values
@ -233,23 +235,23 @@ printed before each message. It is a comma-separated string set. The order of va
Possible values are: Possible values are:
* `none` or `,` - No flags. - `none` or `,` - No flags.
* `date` - the date in the local time zone: `2009/01/23`. - `date` - the date in the local time zone: `2009/01/23`.
* `time` - the time in the local time zone: `01:23:23`. - `time` - the time in the local time zone: `01:23:23`.
* `microseconds` - microsecond resolution: `01:23:23.123123`. Assumes - `microseconds` - microsecond resolution: `01:23:23.123123`. Assumes
time. time.
* `longfile` - full file name and line number: `/a/b/c/d.go:23`. - `longfile` - full file name and line number: `/a/b/c/d.go:23`.
* `shortfile` - final file name element and line number: `d.go:23`. - `shortfile` - final file name element and line number: `d.go:23`.
* `funcname` - function name of the caller: `runtime.Caller()`. - `funcname` - function name of the caller: `runtime.Caller()`.
* `shortfuncname` - last part of the function name. Overrides - `shortfuncname` - last part of the function name. Overrides
`funcname`. `funcname`.
* `utc` - if date or time is set, use UTC rather than the local time - `utc` - if date or time is set, use UTC rather than the local time
zone. zone.
* `levelinitial` - Initial character of the provided level in brackets eg. `[I]` for info. - `levelinitial` - Initial character of the provided level in brackets eg. `[I]` for info.
* `level` - Provided level in brackets `[INFO]` - `level` - Provided level in brackets `[INFO]`
* `medfile` - Last 20 characters of the filename - equivalent to - `medfile` - Last 20 characters of the filename - equivalent to
`shortfile,longfile`. `shortfile,longfile`.
* `stdflags` - Equivalent to `date,time,medfile,shortfuncname,levelinitial` - `stdflags` - Equivalent to `date,time,medfile,shortfuncname,levelinitial`
### Console mode ### Console mode
@ -267,30 +269,30 @@ to the provided `ROOT_PATH` in the master `[log]` section.
Other values: Other values:
* `LOG_ROTATE`: **true**: Rotate the log files. - `LOG_ROTATE`: **true**: Rotate the log files.
* `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb. - `MAX_SIZE_SHIFT`: **28**: Maximum size shift of a single file, 28 represents 256Mb.
* `DAILY_ROTATE`: **true**: Rotate logs daily. - `DAILY_ROTATE`: **true**: Rotate logs daily.
* `MAX_DAYS`: **7**: Delete the log file after n days - `MAX_DAYS`: **7**: Delete the log file after n days
* `COMPRESS`: **true**: Compress old log files by default with gzip - `COMPRESS`: **true**: Compress old log files by default with gzip
* `COMPRESSION_LEVEL`: **-1**: Compression level - `COMPRESSION_LEVEL`: **-1**: Compression level
### Conn mode ### Conn mode
* `RECONNECT_ON_MSG`: **false**: Reconnect host for every single message. - `RECONNECT_ON_MSG`: **false**: Reconnect host for every single message.
* `RECONNECT`: **false**: Try to reconnect when connection is lost. - `RECONNECT`: **false**: Try to reconnect when connection is lost.
* `PROTOCOL`: **tcp**: Set the protocol, either "tcp", "unix" or "udp". - `PROTOCOL`: **tcp**: Set the protocol, either "tcp", "unix" or "udp".
* `ADDR`: **:7020**: Sets the address to connect to. - `ADDR`: **:7020**: Sets the address to connect to.
### SMTP mode ### SMTP mode
It is not recommended to use this logger to send general logging It is not recommended to use this logger to send general logging
messages. However, you could perhaps set this logger to work on `FATAL`. messages. However, you could perhaps set this logger to work on `FATAL`.
* `USER`: User email address to send from. - `USER`: User email address to send from.
* `PASSWD`: Password for the smtp server. - `PASSWD`: Password for the smtp server.
* `HOST`: **127.0.0.1:25**: The SMTP host to connect to. - `HOST`: **127.0.0.1:25**: The SMTP host to connect to.
* `RECEIVERS`: Email addresses to send to. - `RECEIVERS`: Email addresses to send to.
* `SUBJECT`: **Diagnostic message from Gitea** - `SUBJECT`: **Diagnostic message from Gitea**
## Debugging problems ## Debugging problems
@ -386,7 +388,7 @@ Windows. Terminal sniffing will occur on Windows and if it is
determined that we are running on a terminal capable of color we will determined that we are running on a terminal capable of color we will
colorize. colorize.
Further, on *nix it is becoming common to have file logs that are Further, on \*nix it is becoming common to have file logs that are
colored by default. Therefore file logs will be colorised by default colored by default. Therefore file logs will be colorised by default
when not running on Windows. when not running on Windows.
@ -404,13 +406,13 @@ string of bytes which should represent a color and second set of reset
bytes. Pointers were chosen to prevent copying of large numbers of bytes. Pointers were chosen to prevent copying of large numbers of
values. There are several helper methods: values. There are several helper methods:
* `log.NewColoredValue` takes a value and 0 or more color attributes - `log.NewColoredValue` takes a value and 0 or more color attributes
that represent the color. If 0 are provided it will default to a cached that represent the color. If 0 are provided it will default to a cached
bold. Note, it is recommended that color bytes constructed from bold. Note, it is recommended that color bytes constructed from
attributes should be cached if this is a commonly used log message. attributes should be cached if this is a commonly used log message.
* `log.NewColoredValuePointer` takes a pointer to a value, and - `log.NewColoredValuePointer` takes a pointer to a value, and
0 or more color attributes that represent the color. 0 or more color attributes that represent the color.
* `log.NewColoredValueBytes` takes a value and a pointer to an array - `log.NewColoredValueBytes` takes a value and a pointer to an array
of bytes representing the color. of bytes representing the color.
These functions will not double wrap a `log.ColoredValue`. They will These functions will not double wrap a `log.ColoredValue`. They will

@ -3,7 +3,7 @@ date: "2019-10-23T17:00:00-03:00"
title: "Mail templates" title: "Mail templates"
slug: "mail-templates" slug: "mail-templates"
weight: 45 weight: 45
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,20 +15,22 @@ menu:
# Mail templates # Mail templates
**Table of Contents**
{{< toc >}}
To craft the e-mail subject and contents for certain operations, Gitea can be customized by using templates. The templates To craft the e-mail subject and contents for certain operations, Gitea can be customized by using templates. The templates
for these functions are located under the [`custom` directory](https://docs.gitea.io/en-us/customizing-gitea/). for these functions are located under the [`custom` directory](https://docs.gitea.io/en-us/customizing-gitea/).
Gitea has an internal template that serves as default in case there's no custom alternative. Gitea has an internal template that serves as default in case there's no custom alternative.
Custom templates are loaded when Gitea starts. Changes made to them are not recognized until Gitea is restarted again. Custom templates are loaded when Gitea starts. Changes made to them are not recognized until Gitea is restarted again.
{{< toc >}}
## Mail notifications supporting templates ## Mail notifications supporting templates
Currently, the following notification events make use of templates: Currently, the following notification events make use of templates:
| Action name | Usage | | Action name | Usage |
|---------------|--------------------------------------------------------------------------------------------------------------| | ----------- | ------------------------------------------------------------------------------------------------------------ |
| `new` | A new issue or pull request was created. | | `new` | A new issue or pull request was created. |
| `comment` | A new comment was created in an existing issue or pull request. | | `comment` | A new comment was created in an existing issue or pull request. |
| `close` | An issue or pull request was closed. | | `close` | An issue or pull request was closed. |
@ -42,14 +44,15 @@ Currently, the following notification events make use of templates:
The path for the template of a particular message type is: The path for the template of a particular message type is:
``` ```sh
custom/templates/mail/{action type}/{action name}.tmpl custom/templates/mail/{action type}/{action name}.tmpl
``` ```
Where `{action type}` is one of `issue` or `pull` (for pull requests), and `{action name}` is one of the names listed above. Where `{action type}` is one of `issue` or `pull` (for pull requests), and `{action name}` is one of the names listed above.
For example, the specific template for a mail regarding a comment in a pull request is: For example, the specific template for a mail regarding a comment in a pull request is:
```
```sh
custom/templates/mail/pull/comment.tmpl custom/templates/mail/pull/comment.tmpl
``` ```
@ -57,10 +60,10 @@ However, creating templates for each and every action type/name combination is n
A fallback system is used to choose the appropriate template for an event. The _first existing_ A fallback system is used to choose the appropriate template for an event. The _first existing_
template on this list is used: template on this list is used:
* The specific template for the desired **action type** and **action name**. - The specific template for the desired **action type** and **action name**.
* The template for action type `issue` and the desired **action name**. - The template for action type `issue` and the desired **action name**.
* The template for the desired **action type**, action name `default`. - The template for the desired **action type**, action name `default`.
* The template for action type `issue`, action name `default`. - The template for action type `issue`, action name `default`.
The only mandatory template is action type `issue`, action name `default`, which is already embedded in Gitea The only mandatory template is action type `issue`, action name `default`, which is already embedded in Gitea
unless it's overridden by the user in the `custom` directory. unless it's overridden by the user in the `custom` directory.
@ -84,17 +87,16 @@ Text and macros for the mail body
Specifying a _subject_ section is optional (and therefore also the dash line separator). When used, the separator between Specifying a _subject_ section is optional (and therefore also the dash line separator). When used, the separator between
_subject_ and _mail body_ templates requires at least three dashes; no other characters are allowed in the separator line. _subject_ and _mail body_ templates requires at least three dashes; no other characters are allowed in the separator line.
_Subject_ and _mail body_ are parsed by [Golang's template engine](https://golang.org/pkg/text/template/) and _Subject_ and _mail body_ are parsed by [Golang's template engine](https://golang.org/pkg/text/template/) and
are provided with a _metadata context_ assembled for each notification. The context contains the following elements: are provided with a _metadata context_ assembled for each notification. The context contains the following elements:
| Name | Type | Available | Usage | | Name | Type | Available | Usage |
|--------------------|------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------| | ------------------ | ---------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.FallbackSubject` | string | Always | A default subject line. See Below. | | `.FallbackSubject` | string | Always | A default subject line. See Below. |
| `.Subject` | string | Only in body | The _subject_, once resolved. | | `.Subject` | string | Only in body | The _subject_, once resolved. |
| `.Body` | string | Always | The message of the issue, pull request or comment, parsed from Markdown into HTML and sanitized. Do not confuse with the _mail body_. | | `.Body` | string | Always | The message of the issue, pull request or comment, parsed from Markdown into HTML and sanitized. Do not confuse with the _mail body_. |
| `.Link` | string | Always | The address of the originating issue, pull request or comment. | | `.Link` | string | Always | The address of the originating issue, pull request or comment. |
| `.Issue` | models.Issue | Always | The issue (or pull request) originating the notification. To get data specific to a pull request (e.g. `HasMerged`), `.Issue.PullRequest` can be used, but care should be taken as this field will be `nil` if the issue is *not* a pull request. | | `.Issue` | models.Issue | Always | The issue (or pull request) originating the notification. To get data specific to a pull request (e.g. `HasMerged`), `.Issue.PullRequest` can be used, but care should be taken as this field will be `nil` if the issue is _not_ a pull request. |
| `.Comment` | models.Comment | If applicable | If the notification is from a comment added to an issue or pull request, this will contain the information about the comment. | | `.Comment` | models.Comment | If applicable | If the notification is from a comment added to an issue or pull request, this will contain the information about the comment. |
| `.IsPull` | bool | Always | `true` if the mail notification is associated with a pull request (i.e. `.Issue.PullRequest` is not `nil`). | | `.IsPull` | bool | Always | `true` if the mail notification is associated with a pull request (i.e. `.Issue.PullRequest` is not `nil`). |
| `.Repo` | string | Always | Name of the repository, including owner name (e.g. `mike/stuff`) | | `.Repo` | string | Always | Name of the repository, including owner name (e.g. `mike/stuff`) |
@ -115,19 +117,19 @@ Please refer to the linked documentation for details about its syntax.
The _subject_ is built using the following steps: The _subject_ is built using the following steps:
* A template is selected according to the type of notification and to what templates are present. - A template is selected according to the type of notification and to what templates are present.
* The template is parsed and resolved (e.g. `{{.Issue.Index}}` is converted to the number of the issue - The template is parsed and resolved (e.g. `{{.Issue.Index}}` is converted to the number of the issue
or pull request). or pull request).
* All space-like characters (e.g. `TAB`, `LF`, etc.) are converted to normal spaces. - All space-like characters (e.g. `TAB`, `LF`, etc.) are converted to normal spaces.
* All leading, trailing and redundant spaces are removed. - All leading, trailing and redundant spaces are removed.
* The string is truncated to its first 256 runes (characters). - The string is truncated to its first 256 runes (characters).
If the end result is an empty string, **or** no subject template was available (i.e. the selected template If the end result is an empty string, **or** no subject template was available (i.e. the selected template
did not include a subject part), Gitea's **internal default** will be used. did not include a subject part), Gitea's **internal default** will be used.
The internal default (fallback) subject is the equivalent of: The internal default (fallback) subject is the equivalent of:
``` ```sh
{{.SubjectPrefix}}[{{.Repo}}] {{.Issue.Title}} (#.Issue.Index) {{.SubjectPrefix}}[{{.Repo}}] {{.Issue.Title}} (#.Issue.Index)
``` ```
@ -171,7 +173,7 @@ Please check [Gitea's logs](https://docs.gitea.io/en-us/logging-configuration/)
`custom/templates/mail/issue/default.tmpl`: `custom/templates/mail/issue/default.tmpl`:
``` ```html
[{{.Repo}}] @{{.Doer.Name}} [{{.Repo}}] @{{.Doer.Name}}
{{if eq .ActionName "new"}} {{if eq .ActionName "new"}}
created created
@ -247,10 +249,10 @@ This template produces something along these lines:
> >
> #### Message content: > #### Message content:
> >
> \__________________________________________________________________ > \_********************************\_********************************
> >
> Mike, I think we should tone down the blues a little. > Mike, I think we should tone down the blues a little.
> \__________________________________________________________________ > \_********************************\_********************************
> >
> [View it on Gitea](#). > [View it on Gitea](#).
@ -260,7 +262,7 @@ The template system contains several functions that can be used to further proce
the messages. Here's a list of some of them: the messages. Here's a list of some of them:
| Name | Parameters | Available | Usage | | Name | Parameters | Available | Usage |
|----------------------|-------------|-----------|------------------------------------------------------------------------------| | ---------------- | ----------- | --------- | --------------------------------------------------------------------------- |
| `AppUrl` | - | Any | Gitea's URL | | `AppUrl` | - | Any | Gitea's URL |
| `AppName` | - | Any | Set from `app.ini`, usually "Gitea" | | `AppName` | - | Any | Set from `app.ini`, usually "Gitea" |
| `AppDomain` | - | Any | Gitea's host name | | `AppDomain` | - | Any | Gitea's host name |
@ -270,7 +272,7 @@ the messages. Here's a list of some of them:
These are _functions_, not metadata, so they have to be used: These are _functions_, not metadata, so they have to be used:
``` ```html
Like this: {{Str2html "Escape<my>text"}} Like this: {{Str2html "Escape<my>text"}}
Or this: {{"Escape<my>text" | Str2html}} Or this: {{"Escape<my>text" | Str2html}}
Or this: {{AppUrl}} Or this: {{AppUrl}}

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Make" title: "Make"
slug: "make" slug: "make"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-01-14T11:00:00-02:00"
title: "Make 安装" title: "Make 安装"
slug: "make" slug: "make"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-09-06T01:35:00-03:00"
title: "Repository indexer" title: "Repository indexer"
slug: "repo-indexer" slug: "repo-indexer"
weight: 45 weight: 45
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,11 +15,15 @@ menu:
# Repository indexer # Repository indexer
**Table of Contents**
{{< toc >}}
## Setting up the repository indexer ## Setting up the repository indexer
Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/): Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/):
``` ```ini
[indexer] [indexer]
; ... ; ...
REPO_INDEXER_ENABLED = true REPO_INDEXER_ENABLED = true
@ -49,10 +53,10 @@ Limiting the list of files prevents the indexes from becoming polluted with deri
Pattern matching works as follows: Pattern matching works as follows:
* To match all files with a `.txt` extension no matter what directory, use `**.txt`. - To match all files with a `.txt` extension no matter what directory, use `**.txt`.
* To match all files with a `.txt` extension _only at the root level of the repository_, use `*.txt`. - To match all files with a `.txt` extension _only at the root level of the repository_, use `*.txt`.
* To match all files inside `resources/bin` and below, use `resources/bin/**`. - To match all files inside `resources/bin` and below, use `resources/bin/**`.
* To match all files _immediately inside_ `resources/bin`, use `resources/bin/*`. - To match all files _immediately inside_ `resources/bin`, use `resources/bin/*`.
* To match all files named `Makefile`, use `**Makefile`. - To match all files named `Makefile`, use `**Makefile`.
* Matching a directory has no effect; the pattern `resources/bin` will not include/exclude files inside that directory; `resources/bin/**` will. - Matching a directory has no effect; the pattern `resources/bin` will not include/exclude files inside that directory; `resources/bin/**` will.
* All files and patterns are normalized to lower case, so `**Makefile`, `**makefile` and `**MAKEFILE` are equivalent. - All files and patterns are normalized to lower case, so `**Makefile`, `**makefile` and `**MAKEFILE` are equivalent.

@ -3,7 +3,7 @@ date: "2019-12-31T13:55:00+05:00"
title: "Advanced: Search Engines Indexation" title: "Advanced: Search Engines Indexation"
slug: "search-engines-indexation" slug: "search-engines-indexation"
weight: 30 weight: 30
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -15,6 +15,10 @@ menu:
# GPG Commit Signatures # GPG Commit Signatures
**Table of Contents**
{{< toc >}}
Gitea will verify GPG commit signatures in the provided tree by Gitea will verify GPG commit signatures in the provided tree by
checking if the commits are signed by a key within the gitea database, checking if the commits are signed by a key within the gitea database,
or if the commit matches the default key for git. or if the commit matches the default key for git.
@ -36,10 +40,10 @@ this requires git >= 2.0.0.
There are a number of places where Gitea will generate commits itself: There are a number of places where Gitea will generate commits itself:
* Repository Initialisation - Repository Initialisation
* Wiki Changes - Wiki Changes
* CRUD actions using the editor or the API - CRUD actions using the editor or the API
* Merges from Pull Requests - Merges from Pull Requests
Depending on configuration and server trust you may want Gitea to Depending on configuration and server trust you may want Gitea to
sign these commits. sign these commits.
@ -78,10 +82,10 @@ MERGES = pubkey, twofa, basesigned, commitssigned
The first option to discuss is the `SIGNING_KEY`. There are three main The first option to discuss is the `SIGNING_KEY`. There are three main
options: options:
* `none` - this prevents Gitea from signing any commits - `none` - this prevents Gitea from signing any commits
* `default` - Gitea will default to the key configured within - `default` - Gitea will default to the key configured within
`git config` `git config`
* `KEYID` - Gitea will sign commits with the gpg key with the ID - `KEYID` - Gitea will sign commits with the gpg key with the ID
`KEYID`. In this case you should provide a `SIGNING_NAME` and `KEYID`. In this case you should provide a `SIGNING_NAME` and
`SIGNING_EMAIL` to be displayed for this key. `SIGNING_EMAIL` to be displayed for this key.
@ -99,10 +103,10 @@ ideal UI and therefore subject to change.
This option determines whether Gitea should sign the initial commit This option determines whether Gitea should sign the initial commit
when creating a repository. The possible values are: when creating a repository. The possible values are:
* `never`: Never sign - `never`: Never sign
* `pubkey`: Only sign if the user has a public key - `pubkey`: Only sign if the user has a public key
* `twofa`: Only sign if the user logs in with two factor authentication - `twofa`: Only sign if the user logs in with two factor authentication
* `always`: Always sign - `always`: Always sign
Options other than `never` and `always` can be combined as a comma Options other than `never` and `always` can be combined as a comma
separated list. separated list.
@ -112,11 +116,11 @@ separated list.
This options determines if Gitea should sign commits to the Wiki. This options determines if Gitea should sign commits to the Wiki.
The possible values are: The possible values are:
* `never`: Never sign - `never`: Never sign
* `pubkey`: Only sign if the user has a public key - `pubkey`: Only sign if the user has a public key
* `twofa`: Only sign if the user logs in with two factor authentication - `twofa`: Only sign if the user logs in with two factor authentication
* `parentsigned`: Only sign if the parent commit is signed. - `parentsigned`: Only sign if the parent commit is signed.
* `always`: Always sign - `always`: Always sign
Options other than `never` and `always` can be combined as a comma Options other than `never` and `always` can be combined as a comma
separated list. separated list.
@ -126,11 +130,11 @@ separated list.
This option determines if Gitea should sign commits from the web This option determines if Gitea should sign commits from the web
editor or API CRUD actions. The possible values are: editor or API CRUD actions. The possible values are:
* `never`: Never sign - `never`: Never sign
* `pubkey`: Only sign if the user has a public key - `pubkey`: Only sign if the user has a public key
* `twofa`: Only sign if the user logs in with two factor authentication - `twofa`: Only sign if the user logs in with two factor authentication
* `parentsigned`: Only sign if the parent commit is signed. - `parentsigned`: Only sign if the parent commit is signed.
* `always`: Always sign - `always`: Always sign
Options other than `never` and `always` can be combined as a comma Options other than `never` and `always` can be combined as a comma
separated list. separated list.
@ -140,14 +144,14 @@ separated list.
This option determines if Gitea should sign merge commits from PRs. This option determines if Gitea should sign merge commits from PRs.
The possible options are: The possible options are:
* `never`: Never sign - `never`: Never sign
* `pubkey`: Only sign if the user has a public key - `pubkey`: Only sign if the user has a public key
* `twofa`: Only sign if the user logs in with two factor authentication - `twofa`: Only sign if the user logs in with two factor authentication
* `basesigned`: Only sign if the parent commit in the base repo is signed. - `basesigned`: Only sign if the parent commit in the base repo is signed.
* `headsigned`: Only sign if the head commit in the head branch is signed. - `headsigned`: Only sign if the head commit in the head branch is signed.
* `commitssigned`: Only sign if all the commits in the head branch to the merge point are signed. - `commitssigned`: Only sign if all the commits in the head branch to the merge point are signed.
* `approved`: Only sign approved merges to a protected branch. - `approved`: Only sign approved merges to a protected branch.
* `always`: Always sign - `always`: Always sign
Options other than `never` and `always` can be combined as a comma Options other than `never` and `always` can be combined as a comma
separated list. separated list.
@ -156,12 +160,12 @@ separated list.
The public key used to sign Gitea's commits can be obtained from the API at: The public key used to sign Gitea's commits can be obtained from the API at:
``` ```sh
/api/v1/signing-key.gpg /api/v1/signing-key.gpg
``` ```
In cases where there is a repository specific key this can be obtained from: In cases where there is a repository specific key this can be obtained from:
``` ```sh
/api/v1/repos/:username/:reponame/signing-key.gpg /api/v1/repos/:username/:reponame/signing-key.gpg
``` ```

@ -3,7 +3,7 @@ date: "2019-03-11T21:45:00+00:00"
title: "高级: 第三方工具" title: "高级: 第三方工具"
slug: "third-party-tools" slug: "third-party-tools"
weight: 50 weight: 50
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2018-06-24:00:00+02:00"
title: "API Usage" title: "API Usage"
slug: "api-usage" slug: "api-usage"
weight: 40 weight: 40
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,8 @@ menu:
# API Usage # API Usage
**Table of Contents**
{{< toc >}} {{< toc >}}
## Enabling/configuring API access ## Enabling/configuring API access
@ -54,13 +56,13 @@ Access tokens obtained from Gitea's [OAuth2 provider](https://docs.gitea.io/en-u
For historical reasons, Gitea needs the word `token` included before For historical reasons, Gitea needs the word `token` included before
the API key token in an authorization header, like this: the API key token in an authorization header, like this:
``` ```sh
Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675 Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
``` ```
In a `curl` command, for instance, this would look like: In a `curl` command, for instance, this would look like:
``` ```sh
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
-H "accept: application/json" \ -H "accept: application/json" \
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \ -H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
@ -77,7 +79,6 @@ API Reference guide is auto-generated by swagger and available on:
or on or on
[gitea demo instance](https://try.gitea.io/api/swagger) [gitea demo instance](https://try.gitea.io/api/swagger)
## Listing your issued tokens via the API ## Listing your issued tokens via the API
As mentioned in As mentioned in
@ -87,14 +88,14 @@ using BasicAuth, as follows:
### Using basic authentication: ### Using basic authentication:
``` ```sh
$ curl --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens $ curl --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
[{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}] [{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}]
``` ```
As of v1.8.0 of Gitea, if using basic authentication with the API and your user has two factor authentication enabled, you'll need to send an additional header that contains the one time password (6 digit rotating token). An example of the header is `X-Gitea-OTP: 123456` where `123456` is where you'd place the code from your authenticator. Here is how the request would look like in curl: As of v1.8.0 of Gitea, if using basic authentication with the API and your user has two factor authentication enabled, you'll need to send an additional header that contains the one time password (6 digit rotating token). An example of the header is `X-Gitea-OTP: 123456` where `123456` is where you'd place the code from your authenticator. Here is how the request would look like in curl:
``` ```sh
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens $ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
``` ```
@ -104,5 +105,5 @@ The API allows admin users to sudo API requests as another user. Simply add eith
## SDKs ## SDKs
* [Official go-sdk](https://gitea.com/gitea/go-sdk) - [Official go-sdk](https://gitea.com/gitea/go-sdk)
* [more](https://gitea.com/gitea/awesome-gitea#user-content-sdk) - [more](https://gitea.com/gitea/awesome-gitea#user-content-sdk)

@ -3,7 +3,7 @@ date: "2018-06-24:00:00+02:00"
title: "API 使用指南" title: "API 使用指南"
slug: "api-usage" slug: "api-usage"
weight: 40 weight: 40
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -15,6 +15,8 @@ menu:
# Hacking on Gitea # Hacking on Gitea
**Table of Contents**
{{< toc >}} {{< toc >}}
## Installing go ## Installing go
@ -127,9 +129,9 @@ See `make help` for all available `make` targets. Also see [`.drone.yml`](https:
To run and continously rebuild when source files change: To run and continously rebuild when source files change:
````bash ```bash
make watch make watch
```` ```
On macOS, watching all backend source files may hit the default open files limit which can be increased via `ulimit -n 12288` for the current shell or in your shell startup file for all future shells. On macOS, watching all backend source files may hit the default open files limit which can be increased via `ulimit -n 12288` for the current shell or in your shell startup file for all future shells.

@ -3,7 +3,7 @@ date: "2019-04-15T17:29:00+08:00"
title: "Integrations" title: "Integrations"
slug: "integrations" slug: "integrations"
weight: 40 weight: 40
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-04-15T17:29:00+08:00"
title: "Migrations Interfaces" title: "Migrations Interfaces"
slug: "migrations-interfaces" slug: "migrations-interfaces"
weight: 30 weight: 30
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-04-19:44:00+01:00"
title: "OAuth2 provider" title: "OAuth2 provider"
slug: "oauth2-provider" slug: "oauth2-provider"
weight: 41 weight: 41
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -13,25 +13,25 @@ menu:
identifier: "oauth2-provider" identifier: "oauth2-provider"
--- ---
# OAuth2 provider # OAuth2 provider
Gitea supports acting as an OAuth2 provider to allow third party applications to access its resources with the user's consent. This feature is available since release 1.8.0. **Table of Contents**
## Endpoints {{< toc >}}
Gitea supports acting as an OAuth2 provider to allow third party applications to access its resources with the user's consent. This feature is available since release 1.8.0.
Endpoint | URL ## Endpoints
-----------------------|----------------------------
Authorization Endpoint | `/login/oauth/authorize`
Access Token Endpoint | `/login/oauth/access_token`
| Endpoint | URL |
| ---------------------- | --------------------------- |
| Authorization Endpoint | `/login/oauth/authorize` |
| Access Token Endpoint | `/login/oauth/access_token` |
## Supported OAuth2 Grants ## Supported OAuth2 Grants
At the moment Gitea only supports the [**Authorization Code Grant**](https://tools.ietf.org/html/rfc6749#section-1.3.1) standard with additional support of the [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636) extension. At the moment Gitea only supports the [**Authorization Code Grant**](https://tools.ietf.org/html/rfc6749#section-1.3.1) standard with additional support of the [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636) extension.
To use the Authorization Code Grant as a third party application it is required to register a new application via the "Settings" (`/user/settings/applications`) section of the settings. To use the Authorization Code Grant as a third party application it is required to register a new application via the "Settings" (`/user/settings/applications`) section of the settings.
## Scopes ## Scopes
@ -50,7 +50,6 @@ https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=
The `CLIENT_ID` can be obtained by registering an application in the settings. The `STATE` is a random string that will be send back to your application after the user authorizes. The `state` parameter is optional but should be used to prevent CSRF attacks. The `CLIENT_ID` can be obtained by registering an application in the settings. The `STATE` is a random string that will be send back to your application after the user authorizes. The `state` parameter is optional but should be used to prevent CSRF attacks.
![Authorization Page](/authorize.png) ![Authorization Page](/authorize.png)
The user will now be asked to authorize your application. If they authorize it, the user will be redirected to the `REDIRECT_URL`, for example: The user will now be asked to authorize your application. If they authorize it, the user will be redirected to the `REDIRECT_URL`, for example:
@ -76,6 +75,7 @@ POST https://[YOUR-GITEA-URL]/login/oauth/access_token
``` ```
Response: Response:
```json ```json
{ {
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjowLCJleHAiOjE1NTUxNzk5MTIsImlhdCI6MTU1NTE3NjMxMn0.0-iFsAwBtxuckA0sNZ6QpBQmywVPz129u75vOM7wPJecw5wqGyBkmstfJHAjEOqrAf_V5Z-1QYeCh_Cz4RiKug", "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjowLCJleHAiOjE1NTUxNzk5MTIsImlhdCI6MTU1NTE3NjMxMn0.0-iFsAwBtxuckA0sNZ6QpBQmywVPz129u75vOM7wPJecw5wqGyBkmstfJHAjEOqrAf_V5Z-1QYeCh_Cz4RiKug",

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Authentication" title: "Authentication"
slug: "authentication" slug: "authentication"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -22,20 +22,25 @@ menu:
Both the LDAP via BindDN and the simple auth LDAP share the following fields: Both the LDAP via BindDN and the simple auth LDAP share the following fields:
- Authorization Name **(required)** - Authorization Name **(required)**
- A name to assign to the new method of authorization. - A name to assign to the new method of authorization.
- Host **(required)** - Host **(required)**
- The address where the LDAP server can be reached. - The address where the LDAP server can be reached.
- Example: `mydomain.com` - Example: `mydomain.com`
- Port **(required)** - Port **(required)**
- The port to use when connecting to the server. - The port to use when connecting to the server.
- Example: `389` for LDAP or `636` for LDAP SSL - Example: `389` for LDAP or `636` for LDAP SSL
- Enable TLS Encryption (optional) - Enable TLS Encryption (optional)
- Whether to use TLS when connecting to the LDAP server. - Whether to use TLS when connecting to the LDAP server.
- Admin Filter (optional) - Admin Filter (optional)
- An LDAP filter specifying if a user should be given administrator - An LDAP filter specifying if a user should be given administrator
privileges. If a user account passes the filter, the user will be privileges. If a user account passes the filter, the user will be
privileged as an administrator. privileged as an administrator.
@ -43,6 +48,7 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
- Example for Microsoft Active Directory (AD): `(memberOf=CN=admin-group,OU=example,DC=example,DC=org)` - Example for Microsoft Active Directory (AD): `(memberOf=CN=admin-group,OU=example,DC=example,DC=org)`
- Username attribute (optional) - Username attribute (optional)
- The attribute of the user's LDAP record containing the user name. Given - The attribute of the user's LDAP record containing the user name. Given
attribute value will be used for new Gitea account user name after first attribute value will be used for new Gitea account user name after first
successful sign-in. Leave empty to use login name given on sign-in form. successful sign-in. Leave empty to use login name given on sign-in form.
@ -53,11 +59,13 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
- Example for Microsoft Active Directory (AD): `sAMAccountName` - Example for Microsoft Active Directory (AD): `sAMAccountName`
- First name attribute (optional) - First name attribute (optional)
- The attribute of the user's LDAP record containing the user's first name. - The attribute of the user's LDAP record containing the user's first name.
This will be used to populate their account information. This will be used to populate their account information.
- Example: `givenName` - Example: `givenName`
- Surname attribute (optional) - Surname attribute (optional)
- The attribute of the user's LDAP record containing the user's surname. - The attribute of the user's LDAP record containing the user's surname.
This will be used to populate their account information. This will be used to populate their account information.
- Example: `sn` - Example: `sn`
@ -67,19 +75,24 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
address. This will be used to populate their account information. address. This will be used to populate their account information.
- Example: `mail` - Example: `mail`
**LDAP via BindDN** adds the following fields: ### LDAP via BindDN
Adds the following fields:
- Bind DN (optional) - Bind DN (optional)
- The DN to bind to the LDAP server with when searching for the user. This - The DN to bind to the LDAP server with when searching for the user. This
may be left blank to perform an anonymous search. may be left blank to perform an anonymous search.
- Example: `cn=Search,dc=mydomain,dc=com` - Example: `cn=Search,dc=mydomain,dc=com`
- Bind Password (optional) - Bind Password (optional)
- The password for the Bind DN specified above, if any. _Note: The password - The password for the Bind DN specified above, if any. _Note: The password
is stored in plaintext at the server. As such, ensure that the Bind DN is stored in plaintext at the server. As such, ensure that the Bind DN
has as few privileges as possible._ has as few privileges as possible._
- User Search Base **(required)** - User Search Base **(required)**
- The LDAP base at which user accounts will be searched for. - The LDAP base at which user accounts will be searched for.
- Example: `ou=Users,dc=mydomain,dc=com` - Example: `ou=Users,dc=mydomain,dc=com`
@ -96,24 +109,28 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
- Enable user synchronization - Enable user synchronization
- This option enables a periodic task that synchronizes the Gitea users with - This option enables a periodic task that synchronizes the Gitea users with
the LDAP server. The default period is every 24 hours but that can be the LDAP server. The default period is every 24 hours but that can be
changed in the app.ini file. See the *cron.sync_external_users* section in changed in the app.ini file. See the _cron.sync_external_users_ section in
the [sample the [sample
app.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) app.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini)
for detailed comments about that section. The *User Search Base* and *User for detailed comments about that section. The _User Search Base_ and _User
Filter* settings described above will limit which users can use Gitea and Filter_ settings described above will limit which users can use Gitea and
which users will be synchronized. When initially run the task will create which users will be synchronized. When initially run the task will create
all LDAP users that match the given settings so take care if working with all LDAP users that match the given settings so take care if working with
large Enterprise LDAP directories. large Enterprise LDAP directories.
**LDAP using simple auth** adds the following fields: ### LDAP using simple auth
Adds the following fields:
- User DN **(required)** - User DN **(required)**
- A template to use as the user's DN. The `%s` matching parameter will be - A template to use as the user's DN. The `%s` matching parameter will be
substituted with login name given on sign-in form. substituted with login name given on sign-in form.
- Example: `cn=%s,ou=Users,dc=mydomain,dc=com` - Example: `cn=%s,ou=Users,dc=mydomain,dc=com`
- Example: `uid=%s,ou=Users,dc=mydomain,dc=com` - Example: `uid=%s,ou=Users,dc=mydomain,dc=com`
- User Search Base (optional) - User Search Base (optional)
- The LDAP base at which user accounts will be searched for. - The LDAP base at which user accounts will be searched for.
- Example: `ou=Users,dc=mydomain,dc=com` - Example: `ou=Users,dc=mydomain,dc=com`
@ -124,23 +141,28 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
- Example: `(&(objectClass=posixAccount)(cn=%s))` - Example: `(&(objectClass=posixAccount)(cn=%s))`
- Example: `(&(objectClass=posixAccount)(uid=%s))` - Example: `(&(objectClass=posixAccount)(uid=%s))`
**Verify group membership in LDAP** uses the following fields: ### Verify group membership in LDAP
Uses the following fields:
- Group Search Base (optional)
- The LDAP DN used for groups.
- Example: `ou=group,dc=mydomain,dc=com`
- Group Name Filter (optional)
* Group Search Base (optional) - An LDAP filter declaring how to find valid groups in the above DN.
* The LDAP DN used for groups. - Example: `(|(cn=gitea_users)(cn=admins))`
* Example: `ou=group,dc=mydomain,dc=com`
* Group Name Filter (optional) - User Attribute in Group (optional)
* An LDAP filter declaring how to find valid groups in the above DN.
* Example: `(|(cn=gitea_users)(cn=admins))`
* User Attribute in Group (optional) - Which user LDAP attribute is listed in the group.
* Which user LDAP attribute is listed in the group. - Example: `uid`
* Example: `uid`
* Group Attribute for User (optional) - Group Attribute for User (optional)
* Which group LDAP attribute contains an array above user attribute names. - Which group LDAP attribute contains an array above user attribute names.
* Example: `memberUid` - Example: `memberUid`
## PAM (Pluggable Authentication Module) ## PAM (Pluggable Authentication Module)
@ -154,28 +176,35 @@ This option allows Gitea to log in to an SMTP host as a Gitea user. To
configure this, set the fields below: configure this, set the fields below:
- Authentication Name **(required)** - Authentication Name **(required)**
- A name to assign to the new method of authorization. - A name to assign to the new method of authorization.
- SMTP Authentication Type **(required)** - SMTP Authentication Type **(required)**
- Type of authentication to use to connect to SMTP host, PLAIN or LOGIN. - Type of authentication to use to connect to SMTP host, PLAIN or LOGIN.
- Host **(required)** - Host **(required)**
- The address where the SMTP host can be reached. - The address where the SMTP host can be reached.
- Example: `smtp.mydomain.com` - Example: `smtp.mydomain.com`
- Port **(required)** - Port **(required)**
- The port to use when connecting to the server. - The port to use when connecting to the server.
- Example: `587` - Example: `587`
- Allowed Domains - Allowed Domains
- Restrict what domains can log in if using a public SMTP host or SMTP host - Restrict what domains can log in if using a public SMTP host or SMTP host
with multiple domains. with multiple domains.
- Example: `gitea.io,mydomain.com,mydomain2.com` - Example: `gitea.io,mydomain.com,mydomain2.com`
- Enable TLS Encryption - Enable TLS Encryption
- Enable TLS encryption on authentication. - Enable TLS encryption on authentication.
- Skip TLS Verify - Skip TLS Verify
- Disable TLS verify on authentication. - Disable TLS verify on authentication.
- This authentication is activate - This authentication is activate
@ -188,7 +217,8 @@ configure this, set the fields below:
- On the FreeIPA server, create a `gitea.ldif` file, replacing `dc=example,dc=com` - On the FreeIPA server, create a `gitea.ldif` file, replacing `dc=example,dc=com`
with your DN, and provide an appropriately secure password: with your DN, and provide an appropriately secure password:
```
```sh
dn: uid=gitea,cn=sysaccounts,cn=etc,dc=example,dc=com dn: uid=gitea,cn=sysaccounts,cn=etc,dc=example,dc=com
changetype: add changetype: add
objectclass: account objectclass: account
@ -201,14 +231,18 @@ configure this, set the fields below:
- Import the LDIF (change localhost to an IPA server if needed). A prompt for - Import the LDIF (change localhost to an IPA server if needed). A prompt for
Directory Manager password will be presented: Directory Manager password will be presented:
```
```sh
ldapmodify -h localhost -p 389 -x -D \ ldapmodify -h localhost -p 389 -x -D \
"cn=Directory Manager" -W -f gitea.ldif "cn=Directory Manager" -W -f gitea.ldif
``` ```
- Add an IPA group for gitea\_users :
``` - Add an IPA group for gitea_users :
```sh
ipa group-add --desc="Gitea Users" gitea_users ipa group-add --desc="Gitea Users" gitea_users
``` ```
- Note: For errors about IPA credentials, run `kinit admin` and provide the - Note: For errors about IPA credentials, run `kinit admin` and provide the
domain admin account password. domain admin account password.
@ -224,13 +258,15 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y
- Create a separate user account in active directory, under which the `gitea.exe` process will be running (eg. `user` under domain `domain.local`): - Create a separate user account in active directory, under which the `gitea.exe` process will be running (eg. `user` under domain `domain.local`):
- Create a service principal name for the host where `gitea.exe` is running with class `HTTP`: - Create a service principal name for the host where `gitea.exe` is running with class `HTTP`:
- Start `Command Prompt` or `PowerShell` as a priviledged domain user (eg. Domain Administrator) - Start `Command Prompt` or `PowerShell` as a priviledged domain user (eg. Domain Administrator)
- Run the command below, replacing `host.domain.local` with the fully qualified domain name (FQDN) of the server where the web application will be running, and `domain\user` with the name of the account created in the previous step: - Run the command below, replacing `host.domain.local` with the fully qualified domain name (FQDN) of the server where the web application will be running, and `domain\user` with the name of the account created in the previous step:
```
```sh
setspn -A HTTP/host.domain.local domain\user setspn -A HTTP/host.domain.local domain\user
``` ```
- Sign in (*sign out if you were already signed in*) with the user created - Sign in (_sign out if you were already signed in_) with the user created
- Make sure that `ROOT_URL` in the `[server]` section of `custom/conf/app.ini` is the fully qualified domain name of the server where the web application will be running - the same you used when creating the service principal name (eg. `host.domain.local`) - Make sure that `ROOT_URL` in the `[server]` section of `custom/conf/app.ini` is the fully qualified domain name of the server where the web application will be running - the same you used when creating the service principal name (eg. `host.domain.local`)

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "认证" title: "认证"
slug: "authentication" slug: "authentication"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "認證" title: "認證"
slug: "authentication" slug: "authentication"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2018-05-07T13:00:00+02:00"
title: "Gitea compared to other Git hosting options" title: "Gitea compared to other Git hosting options"
slug: "comparison" slug: "comparison"
weight: 5 weight: 5
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,22 +15,26 @@ menu:
# Gitea compared to other Git hosting options # Gitea compared to other Git hosting options
**Table of Contents**
{{< toc >}}
To help decide if Gitea is suited for your needs, here is how it compares to other Git self hosted options. To help decide if Gitea is suited for your needs, here is how it compares to other Git self hosted options.
Be warned that we don't regularly check for feature changes in other products, so this list may be outdated. If you find anything that needs to be updated in the table below, please report it in an [issue on GitHub](https://github.com/go-gitea/gitea/issues). Be warned that we don't regularly check for feature changes in other products, so this list may be outdated. If you find anything that needs to be updated in the table below, please report it in an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
_Symbols used in table:_ _Symbols used in table:_
* _✓ - supported_ - _✓ - supported_
* _⁄ - supported with limited functionality_ - _⁄ - supported with limited functionality_
* _✘ - unsupported_ - _✘ - unsupported_
#### General Features ## General Features
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | | Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|---------|-------|------|-----------|-----------|-----------|-----------|--------------| | ----------------------------------- | -------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ |
| Open source and free | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | | Open source and free | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ |
| Low resource usage (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | | Low resource usage (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ |
| Multiple database support | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ | | Multiple database support | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ |
@ -50,10 +54,10 @@ _Symbols used in table:_
| Built-in CI/CD | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Built-in CI/CD | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Subgroups: groups within groups | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | | Subgroups: groups within groups | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ |
#### Code management ## Code management
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | | Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|---------|-------|------|-----------|-----------|-----------|-----------|--------------| | -------------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ |
| Repository topics | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Repository topics | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Repository code search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | Repository code search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Global code search | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | | Global code search | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
@ -70,10 +74,10 @@ _Symbols used in table:_
| Commit graph | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | Commit graph | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Template Repositories | [](https://github.com/go-gitea/gitea/pull/8768) | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ | | Template Repositories | [](https://github.com/go-gitea/gitea/pull/8768) | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ |
#### Issue Tracker ## Issue Tracker
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | | Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|---------|-------|------|-----------|-----------|-----------|-----------|--------------| | ------------------------------- | -------------------------------------------------- | --------------------------------------------- | --------- | ----------------------------------------------------------------------- | --------- | --------- | ------------ |
| Issue tracker | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | | Issue tracker | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Issue templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | | Issue templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Labels | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | | Labels | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
@ -92,10 +96,10 @@ _Symbols used in table:_
| Create issue via email | [](https://github.com/go-gitea/gitea/issues/6226) | [](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ | | Create issue via email | [](https://github.com/go-gitea/gitea/issues/6226) | [](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ |
| Service Desk | [](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | [](https://gitlab.com/groups/gitlab-org/-/epics/3103) | ✓ | ✘ | ✘ | | Service Desk | [](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | [](https://gitlab.com/groups/gitlab-org/-/epics/3103) | ✓ | ✘ | ✘ |
#### Pull/Merge requests ## Pull/Merge requests
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | | Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|---------|-------|------|-----------|-----------|-----------|-----------|--------------| | ----------------------------------------------- | -------------------------------------------------- | ---- | --------- | --------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------ | ------------ |
| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Squash merging | ✓ | ✘ | ✓ | [](https://docs.gitlab.com/ce/user/project/merge_requests/squash_and_merge.html) | ✓ | ✓ | ✓ | | Squash merging | ✓ | ✘ | ✓ | [](https://docs.gitlab.com/ce/user/project/merge_requests/squash_and_merge.html) | ✓ | ✓ | ✓ |
| Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ | | Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ |
@ -108,11 +112,10 @@ _Symbols used in table:_
| Cherry-picking changes | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Cherry-picking changes | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Download Patch | ✓ | ✘ | ✓ | ✓ | ✓ | [/](https://jira.atlassian.com/plugins/servlet/mobile#issue/BCLOUD-8323) | ✘ | | Download Patch | ✓ | ✘ | ✓ | ✓ | ✓ | [/](https://jira.atlassian.com/plugins/servlet/mobile#issue/BCLOUD-8323) | ✘ |
## 3rd-party integrations
#### 3rd-party integrations
| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | | Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|---------|-------|------|-----------|-----------|-----------|-----------|--------------| | ---------------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ |
| Webhook support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Webhook support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Custom Git Hooks | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Custom Git Hooks | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| AD / LDAP integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | AD / LDAP integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |

@ -3,7 +3,7 @@ date: "2019-02-14T11:51:04+08:00"
title: "横向对比 Gitea 与其它 Git 托管工具" title: "横向对比 Gitea 与其它 Git 托管工具"
slug: "comparison" slug: "comparison"
weight: 5 weight: 5
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Localization" title: "Localization"
slug: "localization" slug: "localization"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "本地化" title: "本地化"
slug: "localization" slug: "localization"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "在地化" title: "在地化"
slug: "localization" slug: "localization"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Webhooks" title: "Webhooks"
slug: "webhooks" slug: "webhooks"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Webhooks" title: "Webhooks"
slug: "webhooks" slug: "webhooks"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Webhooks" title: "Webhooks"
slug: "webhooks" slug: "webhooks"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-04-05T16:00:00+02:00"
title: "FAQ" title: "FAQ"
slug: "faq" slug: "faq"
weight: 5 weight: 5
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -16,11 +16,14 @@ menu:
# Frequently Asked Questions <!-- omit in toc --> # Frequently Asked Questions <!-- omit in toc -->
This page contains some common questions and answers. This page contains some common questions and answers.
Also see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}) For more help resources, check all [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}).
**Table of Contents**
{{< toc >}} {{< toc >}}
## Difference between 1.x and 1.x.x downloads ## Difference between 1.x and 1.x.x downloads
Version 1.7.x will be used for this example. Version 1.7.x will be used for this example.
**NOTE:** this example applies to Docker images as well! **NOTE:** this example applies to Docker images as well!
@ -32,10 +35,11 @@ This means that 1.x downloads will change as commits are merged to their respect
On the other hand, 1.x.x downloads should never change. On the other hand, 1.x.x downloads should never change.
## How to migrate from Gogs/GitHub/etc. to Gitea ## How to migrate from Gogs/GitHub/etc. to Gitea
To migrate from Gogs to Gitea: To migrate from Gogs to Gitea:
* [Gogs version 0.9.146 or less]({{< relref "doc/upgrade/from-gogs.en-us.md" >}}) - [Gogs version 0.9.146 or less]({{< relref "doc/upgrade/from-gogs.en-us.md" >}})
* [Gogs version 0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286) - [Gogs version 0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
To migrate from GitHub to Gitea, you can use Gitea's built-in migration form. To migrate from GitHub to Gitea, you can use Gitea's built-in migration form.
In order to migrate items such as issues, pull requests, etc. you will need to input at least your username. In order to migrate items such as issues, pull requests, etc. you will need to input at least your username.
@ -45,29 +49,31 @@ To migrate from Gitlab to Gitea, you can use this non-affiliated tool:
https://github.com/loganinak/MigrateGitlabToGogs https://github.com/loganinak/MigrateGitlabToGogs
## Where does Gitea store what file ## Where does Gitea store what file
* WorkPath
* Environment variable `GITEA_WORK_DIR` - WorkPath
* Else binary location - Environment variable `GITEA_WORK_DIR`
* AppDataPath (default for database, indexers, etc.) - Else binary location
* `APP_DATA_PATH` from `app.ini` - AppDataPath (default for database, indexers, etc.)
* Else `%(WorkPath)/data` - `APP_DATA_PATH` from `app.ini`
* CustomPath (custom templates) - Else `%(WorkPath)/data`
* Environment variable `GITEA_CUSTOM` - CustomPath (custom templates)
* Else `%(WorkPath)/custom` - Environment variable `GITEA_CUSTOM`
* HomeDir - Else `%(WorkPath)/custom`
* Unix: Environment variable `HOME` - HomeDir
* Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH` - Unix: Environment variable `HOME`
* RepoRootPath - Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH`
* `ROOT` in `app.ini` - RepoRootPath
* Else `%(HomeDir)/gitea-repositories` - `ROOT` in `app.ini`
* INI (config file) - Else `%(HomeDir)/gitea-repositories`
* `-c` flag - INI (config file)
* Else `%(CustomPath)/conf/app.ini` - `-c` flag
* SQLite Database - Else `%(CustomPath)/conf/app.ini`
* `PATH` in `database` section of `app.ini` - SQLite Database
* Else `%(AppDataPath)/gitea.db` - `PATH` in `database` section of `app.ini`
- Else `%(AppDataPath)/gitea.db`
## Not seeing a clone URL or the clone URL being incorrect ## Not seeing a clone URL or the clone URL being incorrect
There are a few places that could make this show incorrectly. There are a few places that could make this show incorrectly.
1. If using a reverse proxy, make sure you have followed the correction directions in the [reverse proxy guide]({{< relref "doc/usage/reverse-proxies.en-us.md" >}}) 1. If using a reverse proxy, make sure you have followed the correction directions in the [reverse proxy guide]({{< relref "doc/usage/reverse-proxies.en-us.md" >}})
@ -79,24 +85,29 @@ If certain clone options aren't showing up (HTTP/S or SSH), the following option
`DISABLE_SSH`: if set to true, there will be no SSH link `DISABLE_SSH`: if set to true, there will be no SSH link
`SSH_EXPOSE_ANONYMOUS`: if set to false, SSH links will be hidden for anonymous users `SSH_EXPOSE_ANONYMOUS`: if set to false, SSH links will be hidden for anonymous users
## Custom Templates not loading or working incorrectly ## Custom Templates not loading or working incorrectly
Gitea's custom templates must be added to the correct location or Gitea will not find and use them. Gitea's custom templates must be added to the correct location or Gitea will not find and use them.
The correct path for the template(s) will be relative to the `CustomPath` The correct path for the template(s) will be relative to the `CustomPath`
1. To find `CustomPath`, look for Custom File Root Path in Site Administration -> Configuration 1. To find `CustomPath`, look for Custom File Root Path in Site Administration -> Configuration
* If that doesn't exist, you can try `echo $GITEA_CUSTOM`
- If that doesn't exist, you can try `echo $GITEA_CUSTOM`
2. If you are still unable to find a path, the default can be [calculated above](#where-does-gitea-store-x-file) 2. If you are still unable to find a path, the default can be [calculated above](#where-does-gitea-store-x-file)
3. Once you have figured out the correct custom path, you can refer to the [customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) page to add your template to the correct location. 3. Once you have figured out the correct custom path, you can refer to the [customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) page to add your template to the correct location.
## Active user vs login prohibited user ## Active user vs login prohibited user
In Gitea, an "active" user refers to a user that has activated their account via email. In Gitea, an "active" user refers to a user that has activated their account via email.
A "login prohibited" user is a user that is not allowed to log in to Gitea anymore A "login prohibited" user is a user that is not allowed to log in to Gitea anymore
## Setting up logging ## Setting up logging
* [Official Docs]({{< relref "doc/advanced/logging-documentation.en-us.md" >}})
- [Official Docs]({{< relref "doc/advanced/logging-documentation.en-us.md" >}})
## What is Swagger? ## What is Swagger?
[Swagger](https://swagger.io/) is what Gitea uses for its API. [Swagger](https://swagger.io/) is what Gitea uses for its API.
All Gitea instances have the built-in API, though it can be disabled by setting `ENABLE_SWAGGER` to `false` in the `api` section of your `app.ini` All Gitea instances have the built-in API, though it can be disabled by setting `ENABLE_SWAGGER` to `false` in the `api` section of your `app.ini`
For more information, refer to Gitea's [API docs]({{< relref "doc/developers/api-usage.en-us.md" >}}) For more information, refer to Gitea's [API docs]({{< relref "doc/developers/api-usage.en-us.md" >}})
@ -106,6 +117,7 @@ For more information, refer to Gitea's [API docs]({{< relref "doc/developers/api
## Adjusting your server for public/private use ## Adjusting your server for public/private use
### Preventing spammers ### Preventing spammers
There are multiple things you can combine to prevent spammers. There are multiple things you can combine to prevent spammers.
1. By only whitelisting certain domains with OpenID (see below) 1. By only whitelisting certain domains with OpenID (see below)
@ -113,28 +125,32 @@ There are multiple things you can combine to prevent spammers.
3. Settings `DISABLE_REGISTRATION` to `true` and creating new users via the [CLI]({{< relref "doc/usage/command-line.en-us.md" >}}), [API]({{< relref "doc/developers/api-usage.en-us.md" >}}), or Gitea's Admin UI 3. Settings `DISABLE_REGISTRATION` to `true` and creating new users via the [CLI]({{< relref "doc/usage/command-line.en-us.md" >}}), [API]({{< relref "doc/developers/api-usage.en-us.md" >}}), or Gitea's Admin UI
### Only allow certain email domains ### Only allow certain email domains
You can configure `EMAIL_DOMAIN_WHITELIST` in your app.ini under `[service]` You can configure `EMAIL_DOMAIN_WHITELIST` in your app.ini under `[service]`
### Only allow/block certain OpenID providers ### Only allow/block certain OpenID providers
You can configure `WHITELISTED_URIS` or `BLACKLISTED_URIS` under `[openid]` in your `app.ini` You can configure `WHITELISTED_URIS` or `BLACKLISTED_URIS` under `[openid]` in your `app.ini`
**NOTE:** whitelisted takes precedence, so if it is non-blank then blacklisted is ignored **NOTE:** whitelisted takes precedence, so if it is non-blank then blacklisted is ignored
### Issue only users ### Issue only users
The current way to achieve this is to create/modify a user with a max repo creation limit of 0. The current way to achieve this is to create/modify a user with a max repo creation limit of 0.
### Restricted users ### Restricted users
Restricted users are limited to a subset of the content based on their organization/team memberships and collaborations, ignoring the public flag on organizations/repos etc.__
Restricted users are limited to a subset of the content based on their organization/team memberships and collaborations, ignoring the public flag on organizations/repos etc.\_\_
Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browseable by all co-workers). Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browseable by all co-workers).
At some point, a customer or third party needs access to a specific repo and only that repo. Making such a customer account restricted and granting any needed access using team membership(s) and/or collaboration(s) is a simple way to achieve that without the need to make everything private. At some point, a customer or third party needs access to a specific repo and only that repo. Making such a customer account restricted and granting any needed access using team membership(s) and/or collaboration(s) is a simple way to achieve that without the need to make everything private.
### Enable Fail2ban ### Enable Fail2ban
Use [Fail2Ban]({{< relref "doc/usage/fail2ban-setup.en-us.md" >}}) to monitor and stop automated login attempts or other malicious behavior based on log patterns Use [Fail2Ban]({{< relref "doc/usage/fail2ban-setup.en-us.md" >}}) to monitor and stop automated login attempts or other malicious behavior based on log patterns
## How to add/use custom themes ## How to add/use custom themes
Gitea supports two official themes right now, `gitea` and `arc-green` (`light` and `dark` respectively) Gitea supports two official themes right now, `gitea` and `arc-green` (`light` and `dark` respectively)
To add your own theme, currently the only way is to provide a complete theme (not just color overrides) To add your own theme, currently the only way is to provide a complete theme (not just color overrides)
@ -143,15 +159,18 @@ Name the `.css` file `theme-arc-blue.css` and add it to your custom folder in `c
Allow users to use it by adding `arc-blue` to the list of `THEMES` in your `app.ini` Allow users to use it by adding `arc-blue` to the list of `THEMES` in your `app.ini`
## SSHD vs built-in SSH ## SSHD vs built-in SSH
SSHD is the built-in SSH server on most Unix systems. SSHD is the built-in SSH server on most Unix systems.
Gitea also provides its own SSH server, for usage when SSHD is not available. Gitea also provides its own SSH server, for usage when SSHD is not available.
## Gitea is running slow ## Gitea is running slow
The most common culprit for this is loading federated avatars. The most common culprit for this is loading federated avatars.
This can be turned off by setting `ENABLE_FEDERATED_AVATAR` to `false` in your `app.ini` This can be turned off by setting `ENABLE_FEDERATED_AVATAR` to `false` in your `app.ini`
Another option that may need to be changed is setting `DISABLE_GRAVATAR` to `true` in your `app.ini` Another option that may need to be changed is setting `DISABLE_GRAVATAR` to `true` in your `app.ini`
## Can't create repositories/files ## Can't create repositories/files
Make sure that Gitea has sufficient permissions to write to its home directory and data directory. Make sure that Gitea has sufficient permissions to write to its home directory and data directory.
See [AppDataPath and RepoRootPath](#where-does-gitea-store-x-file) See [AppDataPath and RepoRootPath](#where-does-gitea-store-x-file)
@ -160,22 +179,26 @@ See [AppDataPath and RepoRootPath](#where-does-gitea-store-x-file)
Which makes all other paths non-writeable to Gitea. Which makes all other paths non-writeable to Gitea.
## Translation is incorrect/how to add more translations ## Translation is incorrect/how to add more translations
Our translations are currently crowd-sourced on our [Crowdin project](https://crowdin.com/project/gitea) Our translations are currently crowd-sourced on our [Crowdin project](https://crowdin.com/project/gitea)
Whether you want to change a translation or add a new one, it will need to be there as all translations are overwritten in our CI via the Crowdin integration. Whether you want to change a translation or add a new one, it will need to be there as all translations are overwritten in our CI via the Crowdin integration.
## Hooks aren't running ## Hooks aren't running
If Gitea is not running hooks, a common cause is incorrect setup of SSH keys. If Gitea is not running hooks, a common cause is incorrect setup of SSH keys.
See [SSH Issues](#ssh-issues) for more information. See [SSH Issues](#ssh-issues) for more information.
You can also try logging into the administration panel and running the `Resynchronize pre-receive, update and post-receive hooks of all repositories.` option. You can also try logging into the administration panel and running the `Resynchronize pre-receive, update and post-receive hooks of all repositories.` option.
## SSH issues ## SSH issues
If you cannot reach repositories over `ssh`, but `https` works fine, consider looking into the following. If you cannot reach repositories over `ssh`, but `https` works fine, consider looking into the following.
First, make sure you can access Gitea via SSH. First, make sure you can access Gitea via SSH.
`ssh git@myremote.example` `ssh git@myremote.example`
If the connection is successful, you should receive an error message like the following: If the connection is successful, you should receive an error message like the following:
``` ```
Hi there, You've successfully authenticated, but Gitea does not provide shell access. Hi there, You've successfully authenticated, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user. If this is unexpected, please log in with password and setup Gitea under another user.
@ -196,20 +219,20 @@ fatal: Could not read from remote repository.
This error signifies that the server rejected a log in attempt, check the This error signifies that the server rejected a log in attempt, check the
following things: following things:
* On the client: - On the client:
* Ensure the public and private ssh keys are added to the correct Gitea user. - Ensure the public and private ssh keys are added to the correct Gitea user.
* Make sure there are no issues in the remote url. In particular, ensure the name of the - Make sure there are no issues in the remote url. In particular, ensure the name of the
git user (before the `@`) is spelled correctly. git user (before the `@`) is spelled correctly.
* Ensure public and private ssh keys are correct on client machine. - Ensure public and private ssh keys are correct on client machine.
* On the server: - On the server:
* Make sure the repository exists and is correctly named. - Make sure the repository exists and is correctly named.
* Check the permissions of the `.ssh` directory in the system user's home directory. - Check the permissions of the `.ssh` directory in the system user's home directory.
* Verify that the correct public keys are added to `.ssh/authorized_keys`. - Verify that the correct public keys are added to `.ssh/authorized_keys`.
Try to run `Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)` on the Try to run `Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)` on the
Gitea admin panel. Gitea admin panel.
* Read Gitea logs. - Read Gitea logs.
* Read /var/log/auth (or similar). - Read /var/log/auth (or similar).
* Check permissions of repositories. - Check permissions of repositories.
The following is an example of a missing public SSH key where authentication The following is an example of a missing public SSH key where authentication
succeeded, but some other setting is preventing SSH from reaching the correct succeeded, but some other setting is preventing SSH from reaching the correct
@ -224,23 +247,25 @@ and the repository exists.
In this case, look into the following settings: In this case, look into the following settings:
* On the server: - On the server:
* Make sure that the `git` system user has a usable shell set - Make sure that the `git` system user has a usable shell set
* Verify this with `getent passwd git | cut -d: -f7` - Verify this with `getent passwd git | cut -d: -f7`
* `usermod` or `chsh` can be used to modify this. - `usermod` or `chsh` can be used to modify this.
* Ensure that the `gitea serv` command in `.ssh/authorized_keys` uses the - Ensure that the `gitea serv` command in `.ssh/authorized_keys` uses the
correct configuration file. correct configuration file.
## Missing releases after migrating repository with tags ## Missing releases after migrating repository with tags
To migrate an repository *with* all tags, you need to do two things: To migrate an repository _with_ all tags, you need to do two things:
- Push tags to the repository:
* Push tags to the repository:
``` ```
git push --tags git push --tags
``` ```
* (Re-)sync tags of all repositories within Gitea: - (Re-)sync tags of all repositories within Gitea:
``` ```
gitea admin repo-sync-releases gitea admin repo-sync-releases
``` ```
@ -254,18 +279,22 @@ batch response: Authentication required: Authorization error: <GITEA_LFS_URL>/in
Check that you have proper access to the repository Check that you have proper access to the repository
error: failed to push some refs to '<GIT_REPO_URL>' error: failed to push some refs to '<GIT_REPO_URL>'
``` ```
Check the value of `LFS_HTTP_AUTH_EXPIRY` in your `app.ini` file. Check the value of `LFS_HTTP_AUTH_EXPIRY` in your `app.ini` file.
By default, your LFS token will expire after 20 minutes. If you have a slow connection or a large file (or both), it may not finish uploading within the time limit. By default, your LFS token will expire after 20 minutes. If you have a slow connection or a large file (or both), it may not finish uploading within the time limit.
You may want to set this value to `60m` or `120m`. You may want to set this value to `60m` or `120m`.
## How can I create users before starting Gitea ## How can I create users before starting Gitea
Gitea provides a sub-command `gitea migrate` to initialize the database, after which you can use the [admin CLI commands]({{< relref "doc/usage/command-line.en-us.md#admin" >}}) to add users like normal. Gitea provides a sub-command `gitea migrate` to initialize the database, after which you can use the [admin CLI commands]({{< relref "doc/usage/command-line.en-us.md#admin" >}}) to add users like normal.
## How can I enable password reset ## How can I enable password reset
There is no setting for password resets. It is enabled when a [mail service]({{< relref "doc/usage/email-setup.en-us.md" >}}) is configured, and disabled otherwise. There is no setting for password resets. It is enabled when a [mail service]({{< relref "doc/usage/email-setup.en-us.md" >}}) is configured, and disabled otherwise.
## How can a user's password be changed ## How can a user's password be changed
- As an **admin**, you can change any user's password (and optionally force them to change it on next login)... - As an **admin**, you can change any user's password (and optionally force them to change it on next login)...
- By navigating to your `Site Administration -> User Accounts` page and editing a user. - By navigating to your `Site Administration -> User Accounts` page and editing a user.
- By using the [admin CLI commands]({{< relref "doc/usage/command-line.en-us.md#admin" >}}). - By using the [admin CLI commands]({{< relref "doc/usage/command-line.en-us.md#admin" >}}).
@ -276,6 +305,7 @@ There is no setting for password resets. It is enabled when a [mail service]({{<
If the `Forgot Password/Account Recovery` page is disabled, please contact your administrator to configure a [mail service]({{< relref "doc/usage/email-setup.en-us.md" >}}). If the `Forgot Password/Account Recovery` page is disabled, please contact your administrator to configure a [mail service]({{< relref "doc/usage/email-setup.en-us.md" >}}).
## Why is my markdown broken ## Why is my markdown broken
In Gitea version `1.11` we moved to [goldmark](https://github.com/yuin/goldmark) for markdown rendering, which is [CommonMark](https://commonmark.org/) compliant. In Gitea version `1.11` we moved to [goldmark](https://github.com/yuin/goldmark) for markdown rendering, which is [CommonMark](https://commonmark.org/) compliant.
If you have markdown that worked as you expected prior to version `1.11` and after upgrading it's not working anymore, please look through the CommonMark spec to see whether the problem is due to a bug or non-compliant syntax. If you have markdown that worked as you expected prior to version `1.11` and after upgrading it's not working anymore, please look through the CommonMark spec to see whether the problem is due to a bug or non-compliant syntax.
If it is the latter, _usually_ there is a compliant alternative listed in the spec. If it is the latter, _usually_ there is a compliant alternative listed in the spec.

@ -3,7 +3,7 @@ date: "2019-11-12T16:00:00+02:00"
title: "Search" title: "Search"
slug: "search" slug: "search"
weight: 4 weight: 4
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-11-12T16:00:00+02:00"
title: "Chercher" title: "Chercher"
slug: "search" slug: "search"
weight: 4 weight: 4
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-11-12T16:00:00+02:00"
title: "搜索" title: "搜索"
slug: "search" slug: "search"
weight: 4 weight: 4
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-11-12T16:00:00+02:00"
title: "搜索" title: "搜索"
slug: "search" slug: "search"
weight: 4 weight: 4
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2018-05-21T15:00:00+00:00"
title: "Support Options" title: "Support Options"
slug: "seek-help" slug: "seek-help"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-01-20T15:00:00+08:00"
title: "需要帮助" title: "需要帮助"
slug: "seek-help" slug: "seek-help"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2020-01-16"
title: "Database Preparation" title: "Database Preparation"
slug: "database-prep" slug: "database-prep"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -21,6 +21,8 @@ Database instance can be on same machine as Gitea (local database setup), or on
Note: All steps below requires that the database engine of your choice is installed on your system. For remote database setup, install the server part on database instance and client part on your Gitea server. In addition, make sure you use same engine version for both server and client for some engine features to work. For security reason, protect `root` (MySQL) or `postgres` (PostgreSQL) database superuser with secure password. The steps assumes that you run Linux for both database and Gitea servers. Note: All steps below requires that the database engine of your choice is installed on your system. For remote database setup, install the server part on database instance and client part on your Gitea server. In addition, make sure you use same engine version for both server and client for some engine features to work. For security reason, protect `root` (MySQL) or `postgres` (PostgreSQL) database superuser with secure password. The steps assumes that you run Linux for both database and Gitea servers.
**Table of Contents**
{{< toc >}} {{< toc >}}
## MySQL ## MySQL
@ -30,6 +32,7 @@ Note: All steps below requires that the database engine of your choice is instal
```ini ```ini
bind-address = 203.0.113.3 bind-address = 203.0.113.3
``` ```
2. On database instance, login to database console as root: 2. On database instance, login to database console as root:
``` ```
@ -58,7 +61,7 @@ Note: All steps below requires that the database engine of your choice is instal
Replace username and password above as appropriate. Replace username and password above as appropriate.
4. Create database with UTF-8 charset and collation. Make sure to use `utf8mb4` charset instead of `utf8` as the former supports all Unicode characters (including emojis) beyond *Basic Multilingual Plane*. Also, collation chosen depending on your expected content. When in doubt, use either `unicode_ci` or `general_ci`. 4. Create database with UTF-8 charset and collation. Make sure to use `utf8mb4` charset instead of `utf8` as the former supports all Unicode characters (including emojis) beyond _Basic Multilingual Plane_. Also, collation chosen depending on your expected content. When in doubt, use either `unicode_ci` or `general_ci`.
```sql ```sql
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'; CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
@ -249,14 +252,12 @@ The PostgreSQL driver used by Gitea supports two-way TLS. In two-way TLS, both d
You should be prompted to enter password for the database user, and then be connected to the database. You should be prompted to enter password for the database user, and then be connected to the database.
### MySQL ### MySQL
While the MySQL driver used by Gitea also supports two-way TLS, Gitea currently supports only one-way TLS. See issue #10828 for details. While the MySQL driver used by Gitea also supports two-way TLS, Gitea currently supports only one-way TLS. See issue #10828 for details.
In one-way TLS, the database client verifies the certificate sent from server during the connection handshake, and the server assumes that the connected client is legitimate, since client certificate verification doesn't take place. In one-way TLS, the database client verifies the certificate sent from server during the connection handshake, and the server assumes that the connected client is legitimate, since client certificate verification doesn't take place.
1. On the database instance, place the following credentials: 1. On the database instance, place the following credentials:
- `/path/to/mysql.crt`: Database instance certificate - `/path/to/mysql.crt`: Database instance certificate

@ -3,7 +3,7 @@ date: "2017-06-19T12:00:00+02:00"
title: "Installation from binary" title: "Installation from binary"
slug: "install-from-binary" slug: "install-from-binary"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -18,6 +18,8 @@ menu:
All downloads come with SQLite, MySQL and PostgreSQL support, and are built with All downloads come with SQLite, MySQL and PostgreSQL support, and are built with
embedded assets. This can be different for older releases. embedded assets. This can be different for older releases.
**Table of Contents**
{{< toc >}} {{< toc >}}
## Download ## Download

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Installation avec le binaire pré-compilé" title: "Installation avec le binaire pré-compilé"
slug: "install-from-binary" slug: "install-from-binary"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "从二进制安装" title: "从二进制安装"
slug: "install-from-binary" slug: "install-from-binary"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "執行檔安裝" title: "執行檔安裝"
slug: "install-from-binary" slug: "install-from-binary"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Installation from package" title: "Installation from package"
slug: "install-from-package" slug: "install-from-package"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,8 @@ menu:
# Installation from package # Installation from package
**Table of Contents**
{{< toc >}} {{< toc >}}
## Alpine Linux ## Alpine Linux
@ -50,6 +52,7 @@ choco install gitea
``` ```
Or follow the [deployment from binary]({{< relref "from-binary.en-us.md" >}}) guide. Or follow the [deployment from binary]({{< relref "from-binary.en-us.md" >}}) guide.
## macOS ## macOS
Currently, the only supported method of installation on MacOS is [Homebrew](http://brew.sh/). Currently, the only supported method of installation on MacOS is [Homebrew](http://brew.sh/).

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Installation depuis le gestionnaire de paquets" title: "Installation depuis le gestionnaire de paquets"
slug: "install-from-package" slug: "install-from-package"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "选择包安装" title: "选择包安装"
slug: "install-from-package" slug: "install-from-package"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "套件安裝" title: "套件安裝"
slug: "install-from-package" slug: "install-from-package"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Installation from source" title: "Installation from source"
slug: "install-from-source" slug: "install-from-source"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -36,6 +36,8 @@ obtain the same version as our continuous integration, see the advice given in
<a href='{{< relref "doc/developers/hacking-on-gitea.en-us.md" >}}'>Hacking on <a href='{{< relref "doc/developers/hacking-on-gitea.en-us.md" >}}'>Hacking on
Gitea</a> Gitea</a>
**Table of Contents**
{{< toc >}} {{< toc >}}
## Download ## Download
@ -92,11 +94,11 @@ are provided to keep the build process as simple as possible.
Depending on requirements, the following build tags can be included. Depending on requirements, the following build tags can be included.
* `bindata`: Build a single monolithic binary, with all assets included. - `bindata`: Build a single monolithic binary, with all assets included.
* `sqlite sqlite_unlock_notify`: Enable support for a - `sqlite sqlite_unlock_notify`: Enable support for a
[SQLite3](https://sqlite.org/) database. Suggested only for tiny [SQLite3](https://sqlite.org/) database. Suggested only for tiny
installations. installations.
* `pam`: Enable support for PAM (Linux Pluggable Authentication Modules). Can - `pam`: Enable support for PAM (Linux Pluggable Authentication Modules). Can
be used to authenticate local users or extend authentication to methods be used to authenticate local users or extend authentication to methods
available to PAM. available to PAM.
@ -153,11 +155,11 @@ One option is to use a script file to shadow the `gitea` binary and create an ap
environment before running Gitea. However, when building you can change these defaults environment before running Gitea. However, when building you can change these defaults
using the `LDFLAGS` environment variable for `make`. The appropriate settings are as follows using the `LDFLAGS` environment variable for `make`. The appropriate settings are as follows
* To set the `CustomPath` use `LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.CustomPath=custom-path\""` - To set the `CustomPath` use `LDFLAGS="-X \"code.gitea.io/gitea/modules/setting.CustomPath=custom-path\""`
* For `CustomConf` you should use `-X \"code.gitea.io/gitea/modules/setting.CustomConf=conf.ini\"` - For `CustomConf` you should use `-X \"code.gitea.io/gitea/modules/setting.CustomConf=conf.ini\"`
* For `AppWorkPath` you should use `-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=working-path\"` - For `AppWorkPath` you should use `-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=working-path\"`
* For `StaticRootPath` you should use `-X \"code.gitea.io/gitea/modules/setting.StaticRootPath=static-root-path\"` - For `StaticRootPath` you should use `-X \"code.gitea.io/gitea/modules/setting.StaticRootPath=static-root-path\"`
* To change the default PID file location use `-X \"code.gitea.io/gitea/modules/setting.PIDFile=/run/gitea.pid\"` - To change the default PID file location use `-X \"code.gitea.io/gitea/modules/setting.PIDFile=/run/gitea.pid\"`
Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable and run `make build` Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable and run `make build`
with the appropriate `TAGS` as above. with the appropriate `TAGS` as above.

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Installation depuis le code source" title: "Installation depuis le code source"
slug: "install-from-source" slug: "install-from-source"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "从源代码安装" title: "从源代码安装"
slug: "install-from-source" slug: "install-from-source"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "原始碼安裝" title: "原始碼安裝"
slug: "install-from-source" slug: "install-from-source"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2020-03-19T19:27:00+02:00"
title: "Install on Kubernetes" title: "Install on Kubernetes"
slug: "install-on-kubernetes" slug: "install-on-kubernetes"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-07-21T12:00:00+02:00"
title: "Run as service in Linux" title: "Run as service in Linux"
slug: "linux-service" slug: "linux-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-07-21T12:00:00+02:00"
title: "在 Linux 中以 service 方式运行" title: "在 Linux 中以 service 方式运行"
slug: "linux-service" slug: "linux-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-21T15:00:00-02:00"
title: "Register as a Windows Service" title: "Register as a Windows Service"
slug: "windows-service" slug: "windows-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Démarrer en tant que service Windows" title: "Démarrer en tant que service Windows"
slug: "windows-service" slug: "windows-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-21T15:00:00-02:00"
title: "注册为Windows服务" title: "注册为Windows服务"
slug: "windows-service" slug: "windows-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-21T15:00:00-02:00"
title: "註冊為 Windows 服務" title: "註冊為 Windows 服務"
slug: "windows-service" slug: "windows-service"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2020-02-09T20:00:00+02:00"
title: "Installation with Docker (rootless)" title: "Installation with Docker (rootless)"
slug: "install-with-docker-rootless" slug: "install-with-docker-rootless"
weight: 10 weight: 10
toc: true toc: false
draft: true draft: true
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2020-03-19T19:27:00+02:00"
title: "Installation with Docker" title: "Installation with Docker"
slug: "install-with-docker" slug: "install-with-docker"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -23,6 +23,8 @@ This reference setup guides users through the setup based on `docker-compose`, b
of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow
the official [install instructions](https://docs.docker.com/compose/install/). the official [install instructions](https://docs.docker.com/compose/install/).
**Table of Contents**
{{< toc >}} {{< toc >}}
## Basics ## Basics
@ -61,7 +63,7 @@ services:
- "222:22" - "222:22"
``` ```
## Custom port ## Ports
To bind the integrated openSSH daemon and the webserver on a different port, adjust To bind the integrated openSSH daemon and the webserver on a different port, adjust
the port section. It's common to just change the host port and keep the ports within the port section. It's common to just change the host port and keep the ports within
@ -95,7 +97,9 @@ services:
+ - "2221:22" + - "2221:22"
``` ```
## MySQL database ## Databases
### MySQL database
To start Gitea in combination with a MySQL database, apply these changes to the To start Gitea in combination with a MySQL database, apply these changes to the
`docker-compose.yml` file created above. `docker-compose.yml` file created above.
@ -146,7 +150,7 @@ services:
+ - ./mysql:/var/lib/mysql + - ./mysql:/var/lib/mysql
``` ```
## PostgreSQL database ### PostgreSQL database
To start Gitea in combination with a PostgreSQL database, apply these changes to To start Gitea in combination with a PostgreSQL database, apply these changes to
the `docker-compose.yml` file created above. the `docker-compose.yml` file created above.
@ -233,7 +237,7 @@ services:
MySQL or PostgreSQL containers will need to be created separately. MySQL or PostgreSQL containers will need to be created separately.
## Start ## Startup
To start this setup based on `docker-compose`, execute `docker-compose up -d`, To start this setup based on `docker-compose`, execute `docker-compose up -d`,
to launch Gitea in the background. Using `docker-compose ps` will show if Gitea to launch Gitea in the background. Using `docker-compose ps` will show if Gitea
@ -245,42 +249,42 @@ and kill the containers. The volumes will still exist.
Notice: if using a non-3000 port on http, change app.ini to match Notice: if using a non-3000 port on http, change app.ini to match
`LOCAL_ROOT_URL = http://localhost:3000/`. `LOCAL_ROOT_URL = http://localhost:3000/`.
## Install ## Installation
After starting the Docker setup via `docker-compose`, Gitea should be available using a After starting the Docker setup via `docker-compose`, Gitea should be available using a
favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the
installation wizard. If the database was started with the `docker-compose` setup as installation wizard. If the database was started with the `docker-compose` setup as
documented above, please note that `db` must be used as the database hostname. documented above, please note that `db` must be used as the database hostname.
## Environments variables ## Environment variables
You can configure some of Gitea's settings via environment variables: You can configure some of Gitea's settings via environment variables:
(Default values are provided in **bold**) (Default values are provided in **bold**)
* `APP_NAME`: **"Gitea: Git with a cup of tea"**: Application name, used in the page title. - `APP_NAME`: **"Gitea: Git with a cup of tea"**: Application name, used in the page title.
* `RUN_MODE`: **prod**: Application run mode, affects performance and debugging. Either "dev", "prod" or "test". - `RUN_MODE`: **prod**: Application run mode, affects performance and debugging. Either "dev", "prod" or "test".
* `DOMAIN`: **localhost**: Domain name of this server, used for the displayed http clone URL in Gitea's UI. - `DOMAIN`: **localhost**: Domain name of this server, used for the displayed http clone URL in Gitea's UI.
* `SSH_DOMAIN`: **localhost**: Domain name of this server, used for the displayed ssh clone URL in Gitea's UI. If the install page is enabled, SSH Domain Server takes DOMAIN value in the form (which overwrite this setting on save). - `SSH_DOMAIN`: **localhost**: Domain name of this server, used for the displayed ssh clone URL in Gitea's UI. If the install page is enabled, SSH Domain Server takes DOMAIN value in the form (which overwrite this setting on save).
* `SSH_PORT`: **22**: SSH port displayed in clone URL. - `SSH_PORT`: **22**: SSH port displayed in clone URL.
* `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server. - `SSH_LISTEN_PORT`: **%(SSH_PORT)s**: Port for the built-in SSH server.
* `DISABLE_SSH`: **false**: Disable SSH feature when it's not available. If you want to disable SSH feature, you should set SSH port to `0` when installing Gitea. - `DISABLE_SSH`: **false**: Disable SSH feature when it's not available. If you want to disable SSH feature, you should set SSH port to `0` when installing Gitea.
* `HTTP_PORT`: **3000**: HTTP listen port. - `HTTP_PORT`: **3000**: HTTP listen port.
* `ROOT_URL`: **""**: Overwrite the automatically generated public URL. This is useful if the internal and the external URL don't match (e.g. in Docker). - `ROOT_URL`: **""**: Overwrite the automatically generated public URL. This is useful if the internal and the external URL don't match (e.g. in Docker).
* `LFS_START_SERVER`: **false**: Enables git-lfs support. - `LFS_START_SERVER`: **false**: Enables git-lfs support.
* `DB_TYPE`: **sqlite3**: The database type in use \[mysql, postgres, mssql, sqlite3\]. - `DB_TYPE`: **sqlite3**: The database type in use \[mysql, postgres, mssql, sqlite3\].
* `DB_HOST`: **localhost:3306**: Database host address and port. - `DB_HOST`: **localhost:3306**: Database host address and port.
* `DB_NAME`: **gitea**: Database name. - `DB_NAME`: **gitea**: Database name.
* `DB_USER`: **root**: Database username. - `DB_USER`: **root**: Database username.
* `DB_PASSWD`: **"\<empty>"**: Database user password. Use \`your password\` for quoting if you use special characters in the password. - `DB_PASSWD`: **"\<empty>"**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
* `INSTALL_LOCK`: **false**: Disallow access to the install page. - `INSTALL_LOCK`: **false**: Disallow access to the install page.
* `SECRET_KEY`: **""**: Global secret key. This should be changed. If this has a value and `INSTALL_LOCK` is empty, `INSTALL_LOCK` will automatically set to `true`. - `SECRET_KEY`: **""**: Global secret key. This should be changed. If this has a value and `INSTALL_LOCK` is empty, `INSTALL_LOCK` will automatically set to `true`.
* `DISABLE_REGISTRATION`: **false**: Disable registration, after which only admin can create accounts for users. - `DISABLE_REGISTRATION`: **false**: Disable registration, after which only admin can create accounts for users.
* `REQUIRE_SIGNIN_VIEW`: **false**: Enable this to force users to log in to view any page. - `REQUIRE_SIGNIN_VIEW`: **false**: Enable this to force users to log in to view any page.
* `USER_UID`: **1000**: The UID (Unix user ID) of the user that runs Gitea within the container. Match this to the UID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes). - `USER_UID`: **1000**: The UID (Unix user ID) of the user that runs Gitea within the container. Match this to the UID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
* `USER_GID`: **1000**: The GID (Unix group ID) of the user that runs Gitea within the container. Match this to the GID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes). - `USER_GID`: **1000**: The GID (Unix group ID) of the user that runs Gitea within the container. Match this to the GID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
# Customization ## Customization
Customization files described [here](https://docs.gitea.io/en-us/customizing-gitea/) should Customization files described [here](https://docs.gitea.io/en-us/customizing-gitea/) should
be placed in `/data/gitea` directory. If using host volumes, it's quite easy to access these be placed in `/data/gitea` directory. If using host volumes, it's quite easy to access these
@ -288,7 +292,7 @@ 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 `/var/lib/docker/volumes/gitea_gitea/_data`. The configuration file will be saved at
`/data/gitea/conf/app.ini` after the installation. `/data/gitea/conf/app.ini` after the installation.
# Upgrading ## Upgrading
:exclamation::exclamation: **Make sure you have volumed data to somewhere outside Docker container** :exclamation::exclamation: :exclamation::exclamation: **Make sure you have volumed data to somewhere outside Docker container** :exclamation::exclamation:
@ -302,7 +306,7 @@ docker-compose pull
docker-compose up -d docker-compose up -d
``` ```
# SSH Container Passthrough ## 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 to forward SSH connections from the host to the container. This setup is explained in the following. 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 to forward SSH connections from the host to the container. This setup is explained in the following.

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Installation avec Docker" title: "Installation avec Docker"
slug: "install-with-docker" slug: "install-with-docker"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "从Docker安装" title: "从Docker安装"
slug: "install-with-docker" slug: "install-with-docker"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Docker 安裝" title: "Docker 安裝"
slug: "install-with-docker" slug: "install-with-docker"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "Upgrade from Gogs" title: "Upgrade from Gogs"
slug: "upgrade-from-gogs" slug: "upgrade-from-gogs"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,10 @@ menu:
# Upgrade from Gogs # Upgrade from Gogs
**Table of Contents**
{{< toc >}}
Gogs, version 0.9.146 and older, can be easily migrated to Gitea. Gogs, version 0.9.146 and older, can be easily migrated to Gitea.
There are some basic steps to follow. On a Linux system run as the Gogs user: There are some basic steps to follow. On a Linux system run as the Gogs user:

@ -3,7 +3,7 @@ date: "2017-08-23T09:00:00+02:00"
title: "Mise à jour depuis Gogs" title: "Mise à jour depuis Gogs"
slug: "upgrade-from-gogs" slug: "upgrade-from-gogs"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "从 Gogs 升级" title: "从 Gogs 升级"
slug: "upgrade-from-gogs" slug: "upgrade-from-gogs"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2016-12-01T16:00:00+02:00"
title: "從 Gogs 升級" title: "從 Gogs 升級"
slug: "upgrade-from-gogs" slug: "upgrade-from-gogs"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-01-01T16:00:00+02:00"
title: "Usage: Backup and Restore" title: "Usage: Backup and Restore"
slug: "backup-and-restore" slug: "backup-and-restore"
weight: 11 weight: 11
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -18,6 +18,10 @@ menu:
Gitea currently has a `dump` command that will save the installation to a zip file. This Gitea currently has a `dump` command that will save the installation to a zip file. This
file can be unpacked and used to restore an instance. file can be unpacked and used to restore an instance.
**Table of Contents**
{{< toc >}}
## Backup Command (`dump`) ## Backup Command (`dump`)
Switch to the user running Gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the Gitea installation Switch to the user running Gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the Gitea installation
@ -34,12 +38,12 @@ directory. There should be some output similar to the following:
Inside the `gitea-dump-1482906742.zip` file, will be the following: Inside the `gitea-dump-1482906742.zip` file, will be the following:
* `app.ini` - Optional copy of configuration file if originally stored outside of the default `custom/` directory - `app.ini` - Optional copy of configuration file if originally stored outside of the default `custom/` directory
* `custom` - All config or customization files in `custom/`. - `custom` - All config or customization files in `custom/`.
* `data` - Data directory in <GITEA_WORK_DIR>, except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, sqlite file if you are using sqlite. - `data` - Data directory in <GITEA_WORK_DIR>, except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, sqlite file if you are using sqlite.
* `gitea-db.sql` - SQL dump of database - `gitea-db.sql` - SQL dump of database
* `gitea-repo.zip` - Complete copy of the repository directory. - `gitea-repo.zip` - Complete copy of the repository directory.
* `log/` - Various logs. They are not needed for a recovery or migration. - `log/` - Various logs. They are not needed for a recovery or migration.
Intermediate backup files are created in a temporary directory specified either with the Intermediate backup files are created in a temporary directory specified either with the
`--tempdir` command-line parameter or the `TMPDIR` environment variable. `--tempdir` command-line parameter or the `TMPDIR` environment variable.
@ -56,7 +60,7 @@ Example:
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf "name=<NAME_OF_DOCKER_CONTAINER>") bash -c '/app/gitea/gitea dump -c </path/to/app.ini>' docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf "name=<NAME_OF_DOCKER_CONTAINER>") bash -c '/app/gitea/gitea dump -c </path/to/app.ini>'
``` ```
*Note: `--tempdir` refers to the temporary directory of the docker environment used by Gitea; if you have not specified a custom `--tempdir`, then Gitea uses `/tmp` or the `TMPDIR` environment variable of the docker container. For `--tempdir` adjust your `docker exec` command options accordingly. \*Note: `--tempdir` refers to the temporary directory of the docker environment used by Gitea; if you have not specified a custom `--tempdir`, then Gitea uses `/tmp` or the `TMPDIR` environment variable of the docker container. For `--tempdir` adjust your `docker exec` command options accordingly.
The result should be a file, stored in the `--tempdir` specified, along the lines of: `gitea-dump-1482906742.zip` The result should be a file, stored in the `--tempdir` specified, along the lines of: `gitea-dump-1482906742.zip`
@ -67,7 +71,7 @@ involves moving files to their correct locations and restoring a database dump.
Example: Example:
```none ```sh
apt-get install gitea apt-get install gitea
unzip gitea-dump-1482906742.zip unzip gitea-dump-1482906742.zip
cd gitea-dump-1482906742 cd gitea-dump-1482906742

@ -3,7 +3,7 @@ date: "2018-06-06T09:33:00+08:00"
title: "使用:备份与恢复" title: "使用:备份与恢复"
slug: "backup-and-restore" slug: "backup-and-restore"
weight: 11 weight: 11
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-01-01T16:00:00+02:00"
title: "用法: 備份與還原" title: "用法: 備份與還原"
slug: "backup-and-restore" slug: "backup-and-restore"
weight: 11 weight: 11
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2017-01-01T16:00:00+02:00"
title: "Usage: Command Line" title: "Usage: Command Line"
slug: "command-line" slug: "command-line"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,8 @@ menu:
# Command Line # Command Line
**Table of Contents**
{{< toc >}} {{< toc >}}
## Usage ## Usage
@ -70,22 +72,10 @@ Admin operations:
- `--id`: ID of user to be deleted. Required. - `--id`: ID of user to be deleted. Required.
- Examples: - Examples:
- `gitea admin user delete --id 1` - `gitea admin user delete --id 1`
- `create`: - `create`: - Options: - `--name value`: Username. Required. As of gitea 1.9.0, use the `--username` flag instead. - `--username value`: Username. Required. New in gitea 1.9.0. - `--password value`: Password. Required. - `--email value`: Email. Required. - `--admin`: If provided, this makes the user an admin. Optional. - `--access-token`: If provided, an access token will be created for the user. Optional. (default: false). - `--must-change-password`: If provided, the created user will be required to choose a newer password after
- Options: the initial login. Optional. (default: true). - `--random-password`: If provided, a randomly generated password will be used as the password of
- `--name value`: Username. Required. As of gitea 1.9.0, use the `--username` flag instead. the created user. The value of `--password` will be discarded. Optional. - `--random-password-length`: If provided, it will be used to configure the length of the randomly
- `--username value`: Username. Required. New in gitea 1.9.0. generated password. Optional. (default: 12) - Examples: - `gitea admin user create --username myname --password asecurepassword --email me@example.com`
- `--password value`: Password. Required.
- `--email value`: Email. Required.
- `--admin`: If provided, this makes the user an admin. Optional.
- `--access-token`: If provided, an access token will be created for the user. Optional. (default: false).
- `--must-change-password`: If provided, the created user will be required to choose a newer password after
the initial login. Optional. (default: true).
- ``--random-password``: If provided, a randomly generated password will be used as the password of
the created user. The value of `--password` will be discarded. Optional.
- `--random-password-length`: If provided, it will be used to configure the length of the randomly
generated password. Optional. (default: 12)
- Examples:
- `gitea admin user create --username myname --password asecurepassword --email me@example.com`
- `change-password`: - `change-password`:
- Options: - Options:
- `--username value`, `-u value`: Username. Required. - `--username value`, `-u value`: Username. Required.
@ -303,13 +293,16 @@ path.
NB: Gitea must be running for this command to succeed. NB: Gitea must be running for this command to succeed.
### migrate ### migrate
Migrates the database. This command can be used to run other commands before starting the server for the first time. Migrates the database. This command can be used to run other commands before starting the server for the first time.
This command is idempotent. This command is idempotent.
### convert ### convert
Converts an existing MySQL database from utf8 to utf8mb4. Converts an existing MySQL database from utf8 to utf8mb4.
### doctor ### doctor
Diagnose the problems of current gitea instance according the given configuration. Diagnose the problems of current gitea instance according the given configuration.
Currently there are a check list below: Currently there are a check list below:

@ -3,7 +3,7 @@ date: "2019-10-15T10:10:00+05:00"
title: "Usage: Email setup" title: "Usage: Email setup"
slug: "email-setup" slug: "email-setup"
weight: 12 weight: 12
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,11 +15,17 @@ menu:
# Email setup # Email setup
**Table of Contents**
{{< toc >}}
To use Gitea's built-in Email support, update the `app.ini` config file [mailer] section: To use Gitea's built-in Email support, update the `app.ini` config file [mailer] section:
## Sendmail version ## Sendmail version
Use the operating system’s sendmail command instead of SMTP. This is common on Linux servers. Use the operating system’s sendmail command instead of SMTP. This is common on Linux servers.
Note: For use in the official Gitea Docker image, please configure with the SMTP version. Note: For use in the official Gitea Docker image, please configure with the SMTP version.
```ini ```ini
[mailer] [mailer]
ENABLED = true ENABLED = true
@ -29,6 +35,7 @@ SENDMAIL_PATH = /usr/sbin/sendmail
``` ```
## SMTP version ## SMTP version
```ini ```ini
[mailer] [mailer]
ENABLED = true ENABLED = true

@ -3,7 +3,7 @@ date: "2018-05-11T11:00:00+02:00"
title: "Usage: Setup fail2ban" title: "Usage: Setup fail2ban"
slug: "fail2ban-setup" slug: "fail2ban-setup"
weight: 16 weight: 16
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-10-06T08:00:00+05:00"
title: "Usage: Git LFS setup" title: "Usage: Git LFS setup"
slug: "git-lfs-setup" slug: "git-lfs-setup"
weight: 12 weight: 12
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2018-06-02T11:00:00+02:00"
title: "Usage: HTTPS setup" title: "Usage: HTTPS setup"
slug: "https-setup" slug: "https-setup"
weight: 12 weight: 12
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,10 @@ menu:
# HTTPS setup to encrypt connections to Gitea # HTTPS setup to encrypt connections to Gitea
**Table of Contents**
{{< toc >}}
## Using the built-in server ## Using the built-in server
Before you enable HTTPS, make sure that you have valid SSL/TLS certificates. Before you enable HTTPS, make sure that you have valid SSL/TLS certificates.
@ -32,6 +36,7 @@ HTTP_PORT = 3000
CERT_FILE = cert.pem CERT_FILE = cert.pem
KEY_FILE = key.pem KEY_FILE = key.pem
``` ```
Note that if your certificate is signed by a third party certificate authority (i.e. not self-signed), then cert.pem should contain the certificate chain. The server certificate must be the first entry in cert.pem, followed by the intermediaries in order (if any). The root certificate does not have to be included because the connecting client must already have it in order to estalbish the trust relationship. Note that if your certificate is signed by a third party certificate authority (i.e. not self-signed), then cert.pem should contain the certificate chain. The server certificate must be the first entry in cert.pem, followed by the intermediaries in order (if any). The root certificate does not have to be included because the connecting client must already have it in order to estalbish the trust relationship.
To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server). To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server).
@ -66,14 +71,14 @@ LETSENCRYPT_EMAIL=email@example.com
To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server). To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server).
## Using reverse proxy ## Using a reverse proxy
Setup up your reverse proxy as shown in the [reverse proxy guide](../reverse-proxies). Setup up your reverse proxy as shown in the [reverse proxy guide](../reverse-proxies).
After that, enable HTTPS by following one of these guides: After that, enable HTTPS by following one of these guides:
* [nginx](https://nginx.org/en/docs/http/configuring_https_servers.html) - [nginx](https://nginx.org/en/docs/http/configuring_https_servers.html)
* [apache2/httpd](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html) - [apache2/httpd](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html)
* [caddy](https://caddyserver.com/docs/tls) - [caddy](https://caddyserver.com/docs/tls)
Note: Enabling HTTPS only at the proxy level is referred as [TLS Termination Proxy](https://en.wikipedia.org/wiki/TLS_termination_proxy). The proxy server accepts incoming TLS connections, decrypts the contents, and passes the now unencrypted contents to Gitea. This is normally fine as long as both the proxy and Gitea instances are either on the same machine, or on different machines within private network (with the proxy is exposed to outside network). If your Gitea instance is separated from your proxy over a public network, or if you want full end-to-end encryption, you can also [enable HTTPS support directly in Gitea using built-in server](#using-the-built-in-server) and forward the connections over HTTPS instead. Note: Enabling HTTPS only at the proxy level is referred as [TLS Termination Proxy](https://en.wikipedia.org/wiki/TLS_termination_proxy). The proxy server accepts incoming TLS connections, decrypts the contents, and passes the now unencrypted contents to Gitea. This is normally fine as long as both the proxy and Gitea instances are either on the same machine, or on different machines within private network (with the proxy is exposed to outside network). If your Gitea instance is separated from your proxy over a public network, or if you want full end-to-end encryption, you can also [enable HTTPS support directly in Gitea using built-in server](#using-the-built-in-server) and forward the connections over HTTPS instead.

@ -3,7 +3,7 @@ date: "2018-05-10T16:00:00+02:00"
title: "Usage: Issue and Pull Request templates" title: "Usage: Issue and Pull Request templates"
slug: "issue-pull-request-templates" slug: "issue-pull-request-templates"
weight: 15 weight: 15
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,10 @@ menu:
# Issue and Pull Request Templates # Issue and Pull Request Templates
**Table of Contents**
{{< toc >}}
Some projects have a standard list of questions that users need to answer Some projects have a standard list of questions that users need to answer
when creating an issue or pull request. Gitea supports adding templates to the when creating an issue or pull request. Gitea supports adding templates to the
main branch of the repository so that they can autopopulate the form when users are main branch of the repository so that they can autopopulate the form when users are
@ -23,53 +27,55 @@ of getting some clarifying details.
Possible file names for issue templates: Possible file names for issue templates:
* ISSUE_TEMPLATE.md - `ISSUE_TEMPLATE.md`
* issue_template.md - `issue_template.md`
* .gitea/ISSUE_TEMPLATE.md - `.gitea/ISSUE_TEMPLATE.md`
* .gitea/issue_template.md - `.gitea/issue_template.md`
* .github/ISSUE_TEMPLATE.md - `.github/ISSUE_TEMPLATE.md`
* .github/issue_template.md - `.github/issue_template.md`
Possible file names for PR templates: Possible file names for PR templates:
* PULL_REQUEST_TEMPLATE.md - `PULL_REQUEST_TEMPLATE.md`
* pull_request_template.md - `pull_request_template.md`
* .gitea/PULL_REQUEST_TEMPLATE.md - `.gitea/PULL_REQUEST_TEMPLATE.md`
* .gitea/pull_request_template.md - `.gitea/pull_request_template.md`
* .github/PULL_REQUEST_TEMPLATE.md - `.github/PULL_REQUEST_TEMPLATE.md`
* .github/pull_request_template.md - `.github/pull_request_template.md`
Additionally, the New Issue page URL can be suffixed with `?title=Issue+Title&body=Issue+Text` and the form will be populated with those strings. Those strings will be used instead of the template if there is one. Additionally, the New Issue page URL can be suffixed with `?title=Issue+Title&body=Issue+Text` and the form will be populated with those strings. Those strings will be used instead of the template if there is one.
# Issue Template Directory ## Issue Template Directory
Alternatively, users can create multiple issue templates inside a special directory and allow users to choose one that more specifically Alternatively, users can create multiple issue templates inside a special directory and allow users to choose one that more specifically
addresses their problem. addresses their problem.
Possible directory names for issue templates: Possible directory names for issue templates:
* ISSUE_TEMPLATE - `ISSUE_TEMPLATE`
* issue_template - `issue_template`
* .gitea/ISSUE_TEMPLATE - `.gitea/ISSUE_TEMPLATE`
* .gitea/issue_template - `.gitea/issue_template`
* .github/ISSUE_TEMPLATE - `.github/ISSUE_TEMPLATE`
* .github/issue_template - `.github/issue_template`
* .gitlab/ISSUE_TEMPLATE - `.gitlab/ISSUE_TEMPLATE`
* .gitlab/issue_template - `.gitlab/issue_template`
Inside the directory can be multiple issue templates with the form Inside the directory can be multiple issue templates with the form
```markdown ```md
----- ---
name: "Template Name" name: "Template Name"
about: "This template is for testing!" about: "This template is for testing!"
title: "[TEST] " title: "[TEST] "
labels: labels:
- bug - bug
- "help needed" - "help needed"
-----
---
This is the template! This is the template!
``` ```

@ -3,7 +3,7 @@ date: "2018-05-10T16:00:00+02:00"
title: "使用:Issue 和 Pull Request 模板" title: "使用:Issue 和 Pull Request 模板"
slug: "issue-pull-request-templates" slug: "issue-pull-request-templates"
weight: 15 weight: 15
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-11-21T17:00:00-03:00"
title: "Usage: Automatically Linked References" title: "Usage: Automatically Linked References"
slug: "automatically-linked-references" slug: "automatically-linked-references"
weight: 15 weight: 15
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,6 +15,10 @@ menu:
# Automatically Linked References in Issues, Pull Requests and Commit Messages # Automatically Linked References in Issues, Pull Requests and Commit Messages
**Table of Contents**
{{< toc >}}
When an issue, pull request or comment is posted, the text description is parsed When an issue, pull request or comment is posted, the text description is parsed
in search for references. These references will be shown as links in the Issue View in search for references. These references will be shown as links in the Issue View
and, in some cases, produce certain _actions_. and, in some cases, produce certain _actions_.
@ -27,8 +31,6 @@ for them to be recognized. For example, they should not be included inside code
text. They should also be reasonably cleared from their surrounding text text. They should also be reasonably cleared from their surrounding text
(for example, using spaces). (for example, using spaces).
{{< toc >}}
## User, Team and Organization Mentions ## User, Team and Organization Mentions
When a text in the form `@username` is found and `username` matches the name When a text in the form `@username` is found and `username` matches the name
@ -108,10 +110,10 @@ is merged.
For an actionable reference to be accepted, _at least one_ of the following For an actionable reference to be accepted, _at least one_ of the following
conditions must be met: conditions must be met:
* The commenter has permissions to close or reopen the issue at the moment - The commenter has permissions to close or reopen the issue at the moment
of creating the reference. of creating the reference.
* The reference is inside a commit message. - The reference is inside a commit message.
* The reference is posted as part of the pull request description. - The reference is posted as part of the pull request description.
In the last case, the issue will be closed or reopened only if the merger In the last case, the issue will be closed or reopened only if the merger
of the pull request has permissions to do so. of the pull request has permissions to do so.
@ -121,8 +123,8 @@ and only issues can be closed or reopened this way.
The default _keywords_ are: The default _keywords_ are:
* **Closing**: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved - **Closing**: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved
* **Reopening**: reopen, reopens, reopened - **Reopening**: reopen, reopens, reopened
## Time tracking in Pull Requests and Commit Messages ## Time tracking in Pull Requests and Commit Messages
@ -135,11 +137,11 @@ multiple fixed issues and spent time for each of them.
Supported time units (`<time-unit>`): Supported time units (`<time-unit>`):
* `m` - minutes - `m` - minutes
* `h` - hours - `h` - hours
* `d` - days (equals to 8 hours) - `d` - days (equals to 8 hours)
* `w` - weeks (equals to 5 days) - `w` - weeks (equals to 5 days)
* `mo` - months (equals to 4 weeks) - `mo` - months (equals to 4 weeks)
Numbers to specify time (`<number>`) can be also decimal numbers, ex. `@1.5h` would Numbers to specify time (`<number>`) can be also decimal numbers, ex. `@1.5h` would
result in one and half hours. Multiple time units can be combined, ex. `@1h10m` would result in one and half hours. Multiple time units can be combined, ex. `@1h10m` would
@ -173,7 +175,7 @@ In the examples, `User1/Repo1` refers to the repository where the reference is u
`UserZ/RepoZ` indicates a different repository. `UserZ/RepoZ` indicates a different repository.
| Reference in User1/Repo1 | Repo1 issues are external | RepoZ issues are external | Should render | | Reference in User1/Repo1 | Repo1 issues are external | RepoZ issues are external | Should render |
|---------------------------|:-------------------------:|:-------------------------:|----------------------------------| | --------------------------- | :-----------------------: | :-----------------------: | ------------------------------------------------------- |
| `#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | | `#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` |
| `!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | | `!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` |
| `#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` | | `#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` |

@ -3,7 +3,7 @@ date: "2018-06-01T19:00:00+02:00"
title: "Usage: Pull Request" title: "Usage: Pull Request"
slug: "pull-request" slug: "pull-request"
weight: 13 weight: 13
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -19,7 +19,7 @@ menu:
Marking a pull request as being a work in progress will prevent that pull request from being accidentally merged. To mark a pull request as being a work in progress, you must prefix its title by `WIP:` or `[WIP]` (case insensitive). Those values are configurable in your `app.ini` file : Marking a pull request as being a work in progress will prevent that pull request from being accidentally merged. To mark a pull request as being a work in progress, you must prefix its title by `WIP:` or `[WIP]` (case insensitive). Those values are configurable in your `app.ini` file :
``` ```ini
[repository.pull-request] [repository.pull-request]
WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP] WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
``` ```

@ -3,7 +3,7 @@ date: "2018-06-01T19:00:00+02:00"
title: "使用:Pull Request" title: "使用:Pull Request"
slug: "pull-request" slug: "pull-request"
weight: 13 weight: 13
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2020-07-06T16:00:00+02:00"
title: "Usage: Push Options" title: "Usage: Push Options"
slug: "push-options" slug: "push-options"
weight: 15 weight: 15
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2018-05-22T11:00:00+00:00"
title: "Usage: Reverse Proxies" title: "Usage: Reverse Proxies"
slug: "reverse-proxies" slug: "reverse-proxies"
weight: 17 weight: 17
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -15,12 +15,15 @@ menu:
# Reverse Proxies # Reverse Proxies
**Table of Contents**
{{< toc >}} {{< toc >}}
## Nginx ## Nginx
If you want Nginx to serve your Gitea instance, add the following `server` section to the `http` section of `nginx.conf`: If you want Nginx to serve your Gitea instance, add the following `server` section to the `http` section of `nginx.conf`:
``` ```apacheconf
server { server {
listen 80; listen 80;
server_name git.example.com; server_name git.example.com;
@ -35,7 +38,7 @@ server {
In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`: In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`:
``` ```apacheconf
server { server {
listen 80; listen 80;
server_name git.example.com; server_name git.example.com;
@ -49,6 +52,7 @@ server {
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration. Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
## Nginx and serve static resources directly ## Nginx and serve static resources directly
We can tune the performance in splitting requests into categories static and dynamic. We can tune the performance in splitting requests into categories static and dynamic.
CSS files, JavaScript files, images and web fonts are static content. CSS files, JavaScript files, images and web fonts are static content.
@ -69,7 +73,7 @@ Depending on the scale of your user base, you might want to split the traffic to
Set `[server] STATIC_URL_PREFIX = /_/static` in your configuration. Set `[server] STATIC_URL_PREFIX = /_/static` in your configuration.
``` ```apacheconf
server { server {
listen 80; listen 80;
server_name git.example.com; server_name git.example.com;
@ -88,7 +92,7 @@ server {
Set `[server] STATIC_URL_PREFIX = http://cdn.example.com/gitea` in your configuration. Set `[server] STATIC_URL_PREFIX = http://cdn.example.com/gitea` in your configuration.
``` ```apacheconf
# application server running gitea # application server running gitea
server { server {
listen 80; listen 80;
@ -100,7 +104,7 @@ server {
} }
``` ```
``` ```apacheconf
# static content delivery server # static content delivery server
server { server {
listen 80; listen 80;
@ -120,7 +124,7 @@ server {
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): 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):
``` ```apacheconf
<VirtualHost *:80> <VirtualHost *:80>
... ...
ProxyPreserveHost On ProxyPreserveHost On
@ -139,7 +143,7 @@ If you wish to use Let's Encrypt with webroot validation, add the line `ProxyPas
In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu): In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
``` ```apacheconf
<VirtualHost *:80> <VirtualHost *:80>
... ...
<Proxy *> <Proxy *>
@ -161,7 +165,7 @@ Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
If you want Caddy to serve your Gitea instance, you can add the following server block to your Caddyfile: If you want Caddy to serve your Gitea instance, you can add the following server block to your Caddyfile:
``` ```apacheconf
git.example.com { git.example.com {
reverse_proxy localhost:3000 reverse_proxy localhost:3000
} }
@ -169,7 +173,7 @@ git.example.com {
If you still use Caddy v1, use: If you still use Caddy v1, use:
``` ```apacheconf
git.example.com { git.example.com {
proxy / localhost:3000 proxy / localhost:3000
} }
@ -179,7 +183,7 @@ git.example.com {
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile: In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile:
``` ```apacheconf
git.example.com { git.example.com {
route /git/* { route /git/* {
uri strip_prefix /git uri strip_prefix /git
@ -190,7 +194,7 @@ git.example.com {
Or, for Caddy v1: Or, for Caddy v1:
``` ```apacheconf
git.example.com { git.example.com {
proxy /git/ localhost:3000 proxy /git/ localhost:3000
} }
@ -204,6 +208,7 @@ If you wish to run Gitea with IIS. You will need to setup IIS with URL Rewrite a
1. Setup an empty website in IIS, named let's say, `Gitea Proxy`. 1. Setup an empty website in IIS, named let's say, `Gitea Proxy`.
2. Follow the first two steps in [Microsoft's Technical Community Guide to Setup IIS with URL Rewrite](https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222#M343). That is: 2. Follow the first two steps in [Microsoft's Technical Community Guide to Setup IIS with URL Rewrite](https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222#M343). That is:
- Install Application Request Routing (ARR for short) either by using the Microsoft Web Platform Installer 5.1 (WebPI) or downloading the extension from [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing) - Install Application Request Routing (ARR for short) either by using the Microsoft Web Platform Installer 5.1 (WebPI) or downloading the extension from [IIS.net](https://www.iis.net/downloads/microsoft/application-request-routing)
- Once the module is installed in IIS, you will see a new Icon in the IIS Administration Console called URL Rewrite. - Once the module is installed in IIS, you will see a new Icon in the IIS Administration Console called URL Rewrite.
- Open the IIS Manager Console and click on the `Gitea Proxy` Website from the tree view on the left. Select and double click the URL Rewrite Icon from the middle pane to load the URL Rewrite interface. - Open the IIS Manager Console and click on the `Gitea Proxy` Website from the tree view on the left. Select and double click the URL Rewrite Icon from the middle pane to load the URL Rewrite interface.

@ -3,7 +3,7 @@ date: "2018-05-22T11:00:00+00:00"
title: "使用:反向代理" title: "使用:反向代理"
slug: "reverse-proxies" slug: "reverse-proxies"
weight: 17 weight: 17
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:

@ -3,7 +3,7 @@ date: "2019-11-28:00:00+02:00"
title: "Template Repositories" title: "Template Repositories"
slug: "template-repositories" slug: "template-repositories"
weight: 14 weight: 14
toc: true toc: false
draft: false draft: false
menu: menu:
sidebar: sidebar:
@ -13,13 +13,20 @@ menu:
identifier: "template-repositories" identifier: "template-repositories"
--- ---
## Template Repositories # Template Repositories
**Table of Contents**
{{< toc >}}
Gitea `1.11.0` and above includes template repositories, and one feature implemented with them is auto-expansion of specific variables within your template files. Gitea `1.11.0` and above includes template repositories, and one feature implemented with them is auto-expansion of specific variables within your template files.
To tell Gitea which files to expand, you must include a `template` file inside the `.gitea` directory of the template repository. To tell Gitea which files to expand, you must include a `template` file inside the `.gitea` directory of the template repository.
Gitea uses [gobwas/glob](https://github.com/gobwas/glob) for its glob syntax. It closely resembles a traditional `.gitignore`, however there may be slight differences. Gitea uses [gobwas/glob](https://github.com/gobwas/glob) for its glob syntax. It closely resembles a traditional `.gitignore`, however there may be slight differences.
### Example `.gitea/template` file ## Example `.gitea/template` file
All paths are relative to the base of the repository All paths are relative to the base of the repository
```gitignore ```gitignore
# All .go files, anywhere in the repository # All .go files, anywhere in the repository
**.go **.go
@ -33,14 +40,16 @@ a/b/c/d.json
# Batch files in both upper or lower case can be matched # Batch files in both upper or lower case can be matched
**.[bB][aA][tT] **.[bB][aA][tT]
``` ```
**NOTE:** The `template` file will be removed from the `.gitea` directory when a repository is generated from the template. **NOTE:** The `template` file will be removed from the `.gitea` directory when a repository is generated from the template.
### Variable Expansion ## Variable Expansion
In any file matched by the above globs, certain variables will be expanded. In any file matched by the above globs, certain variables will be expanded.
All variables must be of the form `$VAR` or `${VAR}`. To escape an expansion, use a double `$$`, such as `$$VAR` or `$${VAR}` All variables must be of the form `$VAR` or `${VAR}`. To escape an expansion, use a double `$$`, such as `$$VAR` or `$${VAR}`
| Variable | Expands To | Transformable | | Variable | Expands To | Transformable |
|----------------------|-----------------------------------------------------|---------------| | -------------------- | --------------------------------------------------- | ------------- |
| REPO_NAME | The name of the generated repository | ✓ | | REPO_NAME | The name of the generated repository | ✓ |
| TEMPLATE_NAME | The name of the template repository | ✓ | | TEMPLATE_NAME | The name of the template repository | ✓ |
| REPO_DESCRIPTION | The description of the generated repository | ✘ | | REPO_DESCRIPTION | The description of the generated repository | ✘ |
@ -54,14 +63,15 @@ All variables must be of the form `$VAR` or `${VAR}`. To escape an expansion, us
| REPO_SSH_URL | The SSH clone link for the generated repository | ✘ | | REPO_SSH_URL | The SSH clone link for the generated repository | ✘ |
| TEMPLATE_SSH_URL | The SSH clone link for the template repository | ✘ | | TEMPLATE_SSH_URL | The SSH clone link for the template repository | ✘ |
### Transformers :robot: ## Transformers :robot:
Gitea `1.12.0` adds a few transformers to some of the applicable variables above. Gitea `1.12.0` adds a few transformers to some of the applicable variables above.
For example, to get `REPO_NAME` in `PASCAL`-case, your template would use `${REPO_NAME_PASCAL}` For example, to get `REPO_NAME` in `PASCAL`-case, your template would use `${REPO_NAME_PASCAL}`
Feeding `go-sdk` to the available transformers yields... Feeding `go-sdk` to the available transformers yields...
| Transformer | Effect | | Transformer | Effect |
|-------------|------------| | ----------- | ------ |
| SNAKE | go_sdk | | SNAKE | go_sdk |
| KEBAB | go-sdk | | KEBAB | go-sdk |
| CAMEL | goSdk | | CAMEL | goSdk |

@ -4,7 +4,7 @@ title: "Documentation"
slug: "documentation" slug: "documentation"
url: "/en-us/" url: "/en-us/"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
--- ---

@ -4,7 +4,7 @@ title: "Documentation"
slug: "documentation" slug: "documentation"
url: "/fr-fr/" url: "/fr-fr/"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
--- ---

@ -4,7 +4,7 @@ title: "文档"
slug: "documentation" slug: "documentation"
url: "/zh-cn/" url: "/zh-cn/"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
--- ---

@ -4,7 +4,7 @@ title: "文件"
slug: "documentation" slug: "documentation"
url: "/zh-tw/" url: "/zh-tw/"
weight: 10 weight: 10
toc: true toc: false
draft: false draft: false
--- ---

Loading…
Cancel
Save