Reformat docs (#13897)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
mj-v1.14.3
Patrick Schratz 3 years ago committed by GitHub
parent 97ab820acc
commit af79677a44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 >}}
@ -127,8 +127,8 @@ copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highl
<script src="https://your-server.com/encode.js"></script> <script src="https://your-server.com/encode.js"></script>
<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){
$('body').append('<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">');
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({
target: 'view-raw',
data: $('.view-raw>a[href$=".stl" i]').attr('href'),
path: '/Madeleine.js/src'
}); });
$('.view-raw>a[href$=".stl"]').remove() }
});
} if ($('.view-raw>a[href$=".stl" i]').length) {
$("body").append(
'<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">'
);
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({
target: "view-raw",
data: $('.view-raw>a[href$=".stl" i]').attr("href"),
path: "/Madeleine.js/src",
});
$('.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
@ -267,7 +279,7 @@ To add a custom license, add a file with the license text to `custom/options/lic
Locales are managed via our [crowdin](https://crowdin.com/project/gitea). Locales are managed via our [crowdin](https://crowdin.com/project/gitea).
You can override a locale by placing an altered locale file in `custom/options/locale`. You can override a locale by placing an altered locale file in `custom/options/locale`.
Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes. Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes.
To add a completely new locale, as well as placing the file in the above location, you will need to add the new lang and name to the `[i18n]` section in your `app.ini`. Keep in mind that Gitea will use those settings as **overrides**, so if you want to keep the other languages as well you will need to copy/paste the default values and add your own to them. To add a completely new locale, as well as placing the file in the above location, you will need to add the new lang and name to the `[i18n]` section in your `app.ini`. Keep in mind that Gitea will use those settings as **overrides**, so if you want to keep the other languages as well you will need to copy/paste the default values and add your own to them.
@ -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,31 +189,31 @@ 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,14 +406,14 @@ 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
also set the `resetBytes` to the cached `resetBytes`. also set the `resetBytes` to the cached `resetBytes`.
@ -467,9 +469,9 @@ You should then add `newOneLogService` to `NewServices()` in
Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` utility: Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` utility:
- Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`. - Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`.
- Install `logrotate`. - Install `logrotate`.
- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10`, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. - Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10`, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections.
- Always do `logrotate /etc/logrotate.conf --debug` to test your configurations. - Always do `logrotate /etc/logrotate.conf --debug` to test your configurations.
The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`. The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`.

@ -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,41 +15,44 @@ 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. |
| `reopen` | An issue or pull request was reopened. | | `reopen` | An issue or pull request was reopened. |
| `review` | The head comment of a review in a pull request. | | `review` | The head comment of a review in a pull request. |
| `approve` | The head comment of a approving review for a pull request. | | `approve` | The head comment of a approving review for a pull request. |
| `reject` | The head comment of a review requesting changes for a pull request. | | `reject` | The head comment of a review requesting changes for a pull request. |
| `code` | A single comment on the code of a pull request. | | `code` | A single comment on the code of a pull request. |
| `assigned` | Used was assigned to an issue or pull request. | | `assigned` | Used was assigned to an issue or pull request. |
| `default` | Any action not included in the above categories, or when the corresponding category template is not present. | | `default` | Any action not included in the above categories, or when the corresponding category template is not present. |
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,27 +87,26 @@ 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`) |
| `.User` | models.User | Always | Owner of the repository from which the event originated. To get the user name (e.g. `mike`),`.User.Name` can be used. | | `.User` | models.User | Always | Owner of the repository from which the event originated. To get the user name (e.g. `mike`),`.User.Name` can be used. |
| `.Doer` | models.User | Always | User that executed the action triggering the notification event. To get the user name (e.g. `rhonda`), `.Doer.Name` can be used. | | `.Doer` | models.User | Always | User that executed the action triggering the notification event. To get the user name (e.g. `rhonda`), `.Doer.Name` can be used. |
| `.IsMention` | bool | Always | `true` if this notification was only generated because the user was mentioned in the comment, while not being subscribed to the source. It will be `false` if the recipient was subscribed to the issue or repository. | | `.IsMention` | bool | Always | `true` if this notification was only generated because the user was mentioned in the comment, while not being subscribed to the source. It will be `false` if the recipient was subscribed to the issue or repository. |
| `.SubjectPrefix` | string | Always | `Re: ` if the notification is about other than issue or pull request creation; otherwise an empty string. | | `.SubjectPrefix` | string | Always | `Re: ` if the notification is about other than issue or pull request creation; otherwise an empty string. |
| `.ActionType` | string | Always | `"issue"` or `"pull"`. Will correspond to the actual _action type_ independently of which template was selected. | | `.ActionType` | string | Always | `"issue"` or `"pull"`. Will correspond to the actual _action type_ independently of which template was selected. |
| `.ActionName` | string | Always | It will be one of the action types described above (`new`, `comment`, etc.), and will correspond to the actual _action name_ independently of which template was selected. | | `.ActionName` | string | Always | It will be one of the action types described above (`new`, `comment`, etc.), and will correspond to the actual _action name_ independently of which template was selected. |
| `.ReviewComments` | []models.Comment | Always | List of code comments in a review. The comment text will be in `.RenderedContent` and the referenced code will be in `.Patch`. | | `.ReviewComments` | []models.Comment | Always | List of code comments in a review. The comment text will be in `.RenderedContent` and the referenced code will be in `.Patch`. |
All names are case sensitive. All names are case sensitive.
@ -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](#).
@ -259,18 +261,18 @@ This template produces something along these lines:
The template system contains several functions that can be used to further process and format The template system contains several functions that can be used to further process and format
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 |
| `EllipsisString` | string, int | Any | Truncates a string to the specified length; adds ellipsis as needed | | `EllipsisString` | string, int | Any | Truncates a string to the specified length; adds ellipsis as needed |
| `Str2html` | string | Body only | Sanitizes text by removing any HTML tags from it. | | `Str2html` | string | Body only | Sanitizes text by removing any HTML tags from it. |
| `Safe` | string | Body only | Takes the input as HTML; can be used for `.ReviewComments.RenderedContent`. | | `Safe` | string | Body only | Takes the input as HTML; can be used for `.ReviewComments.RenderedContent`. |
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,12 +82,12 @@ 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.
The `default` option will interrogate `git config` for The `default` option will interrogate `git config` for
`commit.gpgsign` option - if this is set, then it will use the results `commit.gpgsign` option - if this is set, then it will use the results
@ -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,12 +15,14 @@ menu:
# API Usage # API Usage
**Table of Contents**
{{< toc >}} {{< toc >}}
## Enabling/configuring API access ## Enabling/configuring API access
By default, `ENABLE_SWAGGER` is true, and By default, `ENABLE_SWAGGER` is true, and
`MAX_RESPONSE_ITEMS` is set to 50. See [Config Cheat `MAX_RESPONSE_ITEMS` is set to 50. See [Config Cheat
Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) for more Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) for more
information. information.
@ -33,7 +35,7 @@ Gitea supports these methods of API authentication:
- `access_token=...` parameter in URL query string - `access_token=...` parameter in URL query string
- `Authorization: token ...` header in HTTP headers - `Authorization: token ...` header in HTTP headers
All of these methods accept the same API key token type. You can All of these methods accept the same API key token type. You can
better understand this by looking at the code -- as of this writing, better understand this by looking at the code -- as of this writing,
Gitea parses queries and headers to find the token in Gitea parses queries and headers to find the token in
[modules/auth/auth.go](https://github.com/go-gitea/gitea/blob/6efdcaed86565c91a3dc77631372a9cc45a58e89/modules/auth/auth.go#L47). [modules/auth/auth.go](https://github.com/go-gitea/gitea/blob/6efdcaed86565c91a3dc77631372a9cc45a58e89/modules/auth/auth.go#L47).
@ -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" \
@ -73,10 +75,9 @@ the `token=` string in a GET request.
## API Guide: ## API Guide:
API Reference guide is auto-generated by swagger and available on: API Reference guide is auto-generated by swagger and available on:
`https://gitea.your.host/api/swagger` `https://gitea.your.host/api/swagger`
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
@ -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.
@ -268,7 +270,7 @@ TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
``` ```
will run the integration tests in an sqlite environment. Integration tests will run the integration tests in an sqlite environment. Integration tests
require `git lfs` to be installed. Other database tests are available but require `git lfs` to be installed. Other database tests are available but
may need adjustment to the local environment. may need adjustment to the local environment.
Look at Look at

@ -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
@ -44,49 +44,49 @@ Currently Gitea does not support scopes (see [#4300](https://github.com/go-gitea
1. Redirect to user to the authorization endpoint in order to get his/her consent for accessing the resources: 1. Redirect to user to the authorization endpoint in order to get his/her consent for accessing the resources:
```curl ```curl
https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE
``` ```
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: ```curl
https://[REDIRECT_URI]?code=RETURNED_CODE&state=STATE
```
```curl 2. Using the provided `code` from the redirect, you can request a new application and refresh token. The access token endpoints accepts POST requests with `application/json` and `application/x-www-form-urlencoded` body, for example:
https://[REDIRECT_URI]?code=RETURNED_CODE&state=STATE
```
2. Using the provided `code` from the redirect, you can request a new application and refresh token. The access token endpoints accepts POST requests with `application/json` and `application/x-www-form-urlencoded` body, for example: ```curl
POST https://[YOUR-GITEA-URL]/login/oauth/access_token
```
```curl ```json
POST https://[YOUR-GITEA-URL]/login/oauth/access_token {
``` "client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"code": "RETURNED_CODE",
"grant_type": "authorization_code",
"redirect_uri": "REDIRECT_URI"
}
```
```json Response:
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"code": "RETURNED_CODE",
"grant_type": "authorization_code",
"redirect_uri": "REDIRECT_URI"
}
```
Response: ```json
```json {
{ "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjowLCJleHAiOjE1NTUxNzk5MTIsImlhdCI6MTU1NTE3NjMxMn0.0-iFsAwBtxuckA0sNZ6QpBQmywVPz129u75vOM7wPJecw5wqGyBkmstfJHAjEOqrAf_V5Z-1QYeCh_Cz4RiKug",
"access_token":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjowLCJleHAiOjE1NTUxNzk5MTIsImlhdCI6MTU1NTE3NjMxMn0.0-iFsAwBtxuckA0sNZ6QpBQmywVPz129u75vOM7wPJecw5wqGyBkmstfJHAjEOqrAf_V5Z-1QYeCh_Cz4RiKug", "token_type": "bearer",
"token_type":"bearer", "expires_in": 3600,
"expires_in":3600, "refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjoxLCJjbnQiOjEsImV4cCI6MTU1NzgwNDMxMiwiaWF0IjoxNTU1MTc2MzEyfQ.S_HZQBy4q9r5SEzNGNIoFClT43HPNDbUdHH-GYNYYdkRfft6XptJBkUQscZsGxOW975Yk6RbgtGvq1nkEcklOw"
"refresh_token":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjoxLCJjbnQiOjEsImV4cCI6MTU1NzgwNDMxMiwiaWF0IjoxNTU1MTc2MzEyfQ.S_HZQBy4q9r5SEzNGNIoFClT43HPNDbUdHH-GYNYYdkRfft6XptJBkUQscZsGxOW975Yk6RbgtGvq1nkEcklOw" }
} ```
```
The `CLIENT_SECRET` is the unique secret code generated for this application. Please note that the secret will only be visible after you created/registered the application with Gitea and cannot be recovered. If you lose the secret you must regenerate the secret via the application's settings. The `CLIENT_SECRET` is the unique secret code generated for this application. Please note that the secret will only be visible after you created/registered the application with Gitea and cannot be recovered. If you lose the secret you must regenerate the secret via the application's settings.
The `REDIRECT_URI` in the `access_token` request must match the `REDIRECT_URI` in the `authorize` request. The `REDIRECT_URI` in the `access_token` request must match the `REDIRECT_URI` in the `authorize` request.
3. Use the `access_token` to make [API requests](https://docs.gitea.io/en-us/api-usage#oauth2) to access the user's resources. 3. Use the `access_token` to make [API requests](https://docs.gitea.io/en-us/api-usage#oauth2) to access the user's resources.

@ -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
@ -197,18 +227,22 @@ configure this, set the fields below:
userPassword: secure password userPassword: secure password
passwordExpirationTime: 20380119031407Z passwordExpirationTime: 20380119031407Z
nsIdleTimeout: 0 nsIdleTimeout: 0
``` ```
- 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:
```
setspn -A HTTP/host.domain.local domain\user ```sh
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,114 +15,117 @@ 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 | ✓ | ✓ | ✘ | | | ✓ | ✓ |
| Multiple OS support | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | | Multiple OS support | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ |
| Easy upgrade process | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | | Easy upgrade process | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
| Markdown support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Markdown support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Orgmode support | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? | | Orgmode support | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? |
| CSV support | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? | | CSV support | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? |
| Third-party render tool support | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? | | Third-party render tool support | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? |
| Static Git-powered pages | [](https://github.com/go-gitea/gitea/issues/302) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Static Git-powered pages | [](https://github.com/go-gitea/gitea/issues/302) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Integrated Git-powered wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | | Integrated Git-powered wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Deploy Tokens | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Deploy Tokens | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Repository Tokens with write rights | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ | | Repository Tokens with write rights | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ |
| Built-in Container Registry | [](https://github.com/go-gitea/gitea/issues/2316) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Built-in Container Registry | [](https://github.com/go-gitea/gitea/issues/2316) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| External git mirroring | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | | External git mirroring | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ |
| FIDO U2F (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | FIDO U2F (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| 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 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | | ✓ | | Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | | ✓ |
| Group Milestones | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Group Milestones | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Granular user roles (Code, Issues, Wiki etc) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Granular user roles (Code, Issues, Wiki etc) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Verified Committer | | ✘ | ? | ✓ | ✓ | ✓ | ✘ | | Verified Committer | | ✘ | ? | ✓ | ✓ | ✓ | ✘ |
| GPG Signed Commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | GPG Signed Commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Reject unsigned commits | [](https://github.com/go-gitea/gitea/pull/9708) | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ | | Reject unsigned commits | [](https://github.com/go-gitea/gitea/pull/9708) | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ |
| Repository Activity page | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | Repository Activity page | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Branch manager | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | Branch manager | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Create new branches | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Create new branches | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Web code editor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Web code editor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 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 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Time tracking | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Time tracking | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Multiple assignees for issues | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ | | Multiple assignees for issues | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ |
| Related issues | ✘ | ✘ | | [](https://docs.gitlab.com/ce/user/project/issues/related_issues.html) | ✓ | ✘ | ✘ | | Related issues | ✘ | ✘ | | [](https://docs.gitlab.com/ce/user/project/issues/related_issues.html) | ✓ | ✘ | ✘ |
| Confidential issues | [](https://github.com/go-gitea/gitea/issues/3217) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Confidential issues | [](https://github.com/go-gitea/gitea/issues/3217) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Comment reactions | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Comment reactions | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Lock Discussion | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Lock Discussion | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Batch issue handling | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | | Batch issue handling | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Issue Boards (Kanban) | [](https://github.com/go-gitea/gitea/pull/8346) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Issue Boards (Kanban) | [](https://github.com/go-gitea/gitea/pull/8346) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Create new branches from issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | | Create new branches from issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
| Issue search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | Issue search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Global issue search | [](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | Global issue search | [](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Issue dependency | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | | Issue dependency | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
| 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 | ✓ | ✓ | ✓ | ✘ | | ✘ | ✓ |
| Pull/Merge request inline comments | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | Pull/Merge request inline comments | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Pull/Merge request approval | ✓ | ✘ | | ✓ | ✓ | ✓ | ✓ | | Pull/Merge request approval | ✓ | ✘ | | ✓ | ✓ | ✓ | ✓ |
| Merge conflict resolution | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | Merge conflict resolution | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Restrict push and merge access to certain users | ✓ | ✘ | ✓ | | ✓ | ✓ | ✓ | | Restrict push and merge access to certain users | ✓ | ✘ | ✓ | | ✓ | ✓ | ✓ |
| Revert specific commits or a merge request | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | Revert specific commits or a merge request | [](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Pull/Merge requests templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | | Pull/Merge requests templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
| 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 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | Multiple LDAP / AD server support | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ |
| Multiple LDAP / AD server support | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | | LDAP user synchronization | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| LDAP user synchronization | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | | OpenId Connect support | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ |
| OpenId Connect support | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ | | OAuth 2.0 integration (external authorization) | ✓ | ✘ | | ✓ | ✓ | ? | ✓ |
| OAuth 2.0 integration (external authorization) | ✓ | ✘ | | ✓ | ✓ | ? | ✓ | | Act as OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Act as OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | Two factor authentication (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Two factor authentication (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | | Mattermost/Slack integration | ✓ | ✓ | | ✓ | ✓ | | ✓ |
| Mattermost/Slack integration | ✓ | ✓ | | ✓ | ✓ | | ✓ | | Discord integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
| Discord integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | | Microsoft Teams integration | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
| Microsoft Teams integration | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | | External CI/CD status display | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
| External CI/CD status display | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |

@ -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,26 +16,30 @@ 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!
On our [downloads page](https://dl.gitea.io/gitea/) you will see a 1.7 directory, as well as directories for 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, and 1.7.6. On our [downloads page](https://dl.gitea.io/gitea/) you will see a 1.7 directory, as well as directories for 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, and 1.7.6.
The 1.7 and 1.7.0 directories are **not** the same. The 1.7 directory is built on each merged commit to the [`release/v1.7`](https://github.com/go-gitea/gitea/tree/release/v1.7) branch. The 1.7 and 1.7.0 directories are **not** the same. The 1.7 directory is built on each merged commit to the [`release/v1.7`](https://github.com/go-gitea/gitea/tree/release/v1.7) branch.
The 1.7.0 directory, however, is a build that was created when the [`v1.7.0`](https://github.com/go-gitea/gitea/releases/tag/v1.7.0) tag was created. The 1.7.0 directory, however, is a build that was created when the [`v1.7.0`](https://github.com/go-gitea/gitea/releases/tag/v1.7.0) tag was created.
This means that 1.x downloads will change as commits are merged to their respective branch (think of it as a separate "master" branch for each release). This means that 1.x downloads will change as commits are merged to their respective branch (think of it as a separate "master" branch for each release).
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" >}})
@ -77,26 +83,31 @@ If certain clone options aren't showing up (HTTP/S or SSH), the following option
`DISABLE_HTTP_GIT`: if set to true, there will be no HTTP/HTTPS link `DISABLE_HTTP_GIT`: if set to true, there will be no HTTP/HTTPS link
`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,52 +117,60 @@ 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)
2. Setting `ENABLE_CAPTCHA` to `true` in your `app.ini` and properly configuring `RECAPTCHA_SECRET` and `RECAPTCHA_SITEKEY` 2. Setting `ENABLE_CAPTCHA` to `true` in your `app.ini` and properly configuring `RECAPTCHA_SECRET` and `RECAPTCHA_SITEKEY`
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)
As an example, let's say our theme is `arc-blue` (this is a real theme, and can be found [in this issue](https://github.com/go-gitea/gitea/issues/6011)) As an example, let's say our theme is `arc-blue` (this is a real theme, and can be found [in this issue](https://github.com/go-gitea/gitea/issues/6011))
Name the `.css` file `theme-arc-blue.css` and add it to your custom folder in `custom/pulic/css` Name the `.css` file `theme-arc-blue.css` and add it to your custom folder in `custom/pulic/css`
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,58 +247,65 @@ 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
```
## LFS Issues ## LFS Issues
For issues concerning LFS data upload For issues concerning LFS data upload
``` ```
batch response: Authentication required: Authorization error: <GITEA_LFS_URL>/info/lfs/objects/batch batch response: Authentication required: Authorization error: <GITEA_LFS_URL>/info/lfs/objects/batch
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" >}}).
Keep in mind most commands will also need a [global flag]({{< relref "doc/usage/command-line.en-us.md#global-options" >}}) to point the CLI at the correct configuration. Keep in mind most commands will also need a [global flag]({{< relref "doc/usage/command-line.en-us.md#global-options" >}}) to point the CLI at the correct configuration.
- As a **user** you can change it... - As a **user** you can change it...
- In your account `Settings -> Account` page (this method **requires** you to know your current password). - In your account `Settings -> Account` page (this method **requires** you to know your current password).
- By using the `Forgot Password` link. - By using the `Forgot Password` link.
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:
@ -19,7 +19,9 @@ You need a database to use Gitea. Gitea supports PostgreSQL, MySQL, SQLite, and
Database instance can be on same machine as Gitea (local database setup), or on different machine (remote database). Database instance can be on same machine as Gitea (local database setup), or on different machine (remote database).
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 >}}
@ -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';
@ -187,9 +190,9 @@ The PostgreSQL driver used by Gitea supports two-way TLS. In two-way TLS, both d
1. On the server with the database instance, place the following credentials: 1. On the server with the database instance, place the following credentials:
- `/path/to/postgresql.crt`: Database instance certificate - `/path/to/postgresql.crt`: Database instance certificate
- `/path/to/postgresql.key`: Database instance private key - `/path/to/postgresql.key`: Database instance private key
- `/path/to/root.crt`: CA certificate chain to validate client certificates - `/path/to/root.crt`: CA certificate chain to validate client certificates
2. Add following options to `postgresql.conf`: 2. Add following options to `postgresql.conf`:
@ -228,9 +231,9 @@ The PostgreSQL driver used by Gitea supports two-way TLS. In two-way TLS, both d
6. On the server running the Gitea instance, place the following credentials under the home directory of the user who runs Gitea (e.g. `git`): 6. On the server running the Gitea instance, place the following credentials under the home directory of the user who runs Gitea (e.g. `git`):
- `~/.postgresql/postgresql.crt`: Database client certificate - `~/.postgresql/postgresql.crt`: Database client certificate
- `~/.postgresql/postgresql.key`: Database client private key - `~/.postgresql/postgresql.key`: Database client private key
- `~/.postgresql/root.crt`: CA certificate chain to validate server certificate - `~/.postgresql/root.crt`: CA certificate chain to validate server certificate
Note: Those file names above are hardcoded in PostgreSQL and it is not possible to change them. Note: Those file names above are hardcoded in PostgreSQL and it is not possible to change them.
@ -249,19 +252,17 @@ 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
- `/path/to/mysql.key`: Database instance key - `/path/to/mysql.key`: Database instance key
- `/path/to/ca.crt`: CA certificate chain. This file isn't used on one-way TLS, but is used to validate client certificates on two-way TLS. - `/path/to/ca.crt`: CA certificate chain. This file isn't used on one-way TLS, but is used to validate client certificates on two-way TLS.
2. Add following options to `my.cnf`: 2. Add following options to `my.cnf`:

@ -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
@ -41,195 +43,183 @@ changed at build time (if preferred).
Starts the server: Starts the server:
- Options: - Options:
- `--port number`, `-p number`: Port number. Optional. (default: 3000). Overrides configuration file. - `--port number`, `-p number`: Port number. Optional. (default: 3000). Overrides configuration file.
- `--install-port number`: Port number to run the install page on. Optional. (default: 3000). Overrides configuration file. - `--install-port number`: Port number to run the install page on. Optional. (default: 3000). Overrides configuration file.
- `--pid path`, `-P path`: Pidfile path. Optional. - `--pid path`, `-P path`: Pidfile path. Optional.
- Examples: - Examples:
- `gitea web` - `gitea web`
- `gitea web --port 80` - `gitea web --port 80`
- `gitea web --config /etc/gitea.ini --pid /some/custom/gitea.pid` - `gitea web --config /etc/gitea.ini --pid /some/custom/gitea.pid`
- Notes: - Notes:
- Gitea should not be run as root. To bind to a port below 1024, you can use setcap on - Gitea should not be run as root. To bind to a port below 1024, you can use setcap on
Linux: `sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`. This will need to be Linux: `sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`. This will need to be
redone every time you update Gitea. redone every time you update Gitea.
### admin ### admin
Admin operations: Admin operations:
- Commands: - Commands:
- `user`: - `user`:
- `list`: - `list`:
- Options: - Options:
- `--admin`: List only admin users. Optional. - `--admin`: List only admin users. Optional.
- Description: lists all users that exist - Description: lists all users that exist
- Examples: - Examples:
- `gitea admin user list` - `gitea admin user list`
- `delete`: - `delete`:
- Options: - Options:
- `--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. - `change-password`:
- `--email value`: Email. Required. - Options:
- `--admin`: If provided, this makes the user an admin. Optional. - `--username value`, `-u value`: Username. Required.
- `--access-token`: If provided, an access token will be created for the user. Optional. (default: false). - `--password value`, `-p value`: New password. Required.
- `--must-change-password`: If provided, the created user will be required to choose a newer password after - Examples:
the initial login. Optional. (default: true). - `gitea admin user change-password --username myname --password asecurepassword`
- ``--random-password``: If provided, a randomly generated password will be used as the password of - `regenerate`
the created user. The value of `--password` will be discarded. Optional. - Options:
- `--random-password-length`: If provided, it will be used to configure the length of the randomly - `hooks`: Regenerate git-hooks for all repositories
generated password. Optional. (default: 12) - `keys`: Regenerate authorized_keys file
- Examples: - Examples:
- `gitea admin user create --username myname --password asecurepassword --email me@example.com` - `gitea admin regenerate hooks`
- `change-password`: - `gitea admin regenerate keys`
- Options: - `auth`:
- `--username value`, `-u value`: Username. Required. - `list`:
- `--password value`, `-p value`: New password. Required. - Description: lists all external authentication sources that exist
- Examples: - Examples:
- `gitea admin user change-password --username myname --password asecurepassword` - `gitea admin auth list`
- `regenerate` - `delete`:
- Options: - Options:
- `hooks`: Regenerate git-hooks for all repositories - `--id`: ID of source to be deleted. Required.
- `keys`: Regenerate authorized_keys file - Examples:
- Examples: - `gitea admin auth delete --id 1`
- `gitea admin regenerate hooks` - `add-oauth`:
- `gitea admin regenerate keys` - Options:
- `auth`: - `--name`: Application Name.
- `list`: - `--provider`: OAuth2 Provider.
- Description: lists all external authentication sources that exist - `--key`: Client ID (Key).
- Examples: - `--secret`: Client Secret.
- `gitea admin auth list` - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
- `delete`: - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
- Options: - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
- `--id`: ID of source to be deleted. Required. - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
- Examples: - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
- `gitea admin auth delete --id 1` - `--custom-email-url`: Use a custom Email URL (option for GitHub).
- `add-oauth`: - Examples:
- Options: - `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
- `--name`: Application Name. - `update-oauth`:
- `--provider`: OAuth2 Provider. - Options:
- `--key`: Client ID (Key). - `--id`: ID of source to be updated. Required.
- `--secret`: Client Secret. - `--name`: Application Name.
- `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider). - `--provider`: OAuth2 Provider.
- `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints. - `--key`: Client ID (Key).
- `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub). - `--secret`: Client Secret.
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub). - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub). - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
- `--custom-email-url`: Use a custom Email URL (option for GitHub). - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
- Examples: - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
- `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE` - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
- `update-oauth`: - `--custom-email-url`: Use a custom Email URL (option for GitHub).
- Options: - Examples:
- `--id`: ID of source to be updated. Required. - `gitea admin auth update-oauth --id 1 --name external-github-updated`
- `--name`: Application Name. - `add-ldap`: Add new LDAP (via Bind DN) authentication source
- `--provider`: OAuth2 Provider. - Options:
- `--key`: Client ID (Key). - `--name value`: Authentication name. Required.
- `--secret`: Client Secret. - `--not-active`: Deactivate the authentication source.
- `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider). - `--security-protocol value`: Security protocol name. Required.
- `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints. - `--skip-tls-verify`: Disable TLS verification.
- `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub). - `--host value`: The address where the LDAP server can be reached. Required.
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub). - `--port value`: The port to use when connecting to the LDAP server. Required.
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub). - `--user-search-base value`: The LDAP base at which user accounts will be searched for. Required.
- `--custom-email-url`: Use a custom Email URL (option for GitHub). - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required.
- Examples: - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
- `gitea admin auth update-oauth --id 1 --name external-github-updated` - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
- `add-ldap`: Add new LDAP (via Bind DN) authentication source - `--username-attribute value`: The attribute of the users LDAP record containing the user name.
- Options: - `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name.
- `--name value`: Authentication name. Required. - `--surname-attribute value`: The attribute of the users LDAP record containing the users surname.
- `--not-active`: Deactivate the authentication source. - `--email-attribute value`: The attribute of the users LDAP record containing the users email address. Required.
- `--security-protocol value`: Security protocol name. Required. - `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key.
- `--skip-tls-verify`: Disable TLS verification. - `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user.
- `--host value`: The address where the LDAP server can be reached. Required. - `--bind-password value`: The password for the Bind DN, if any.
- `--port value`: The port to use when connecting to the LDAP server. Required. - `--attributes-in-bind`: Fetch attributes in bind DN context.
- `--user-search-base value`: The LDAP base at which user accounts will be searched for. Required. - `--synchronize-users`: Enable user synchronization.
- `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required. - `--page-size value`: Search page size.
- `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges. - Examples:
- `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status. - `gitea admin auth add-ldap --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-search-base "ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(uid=%s))" --email-attribute mail`
- `--username-attribute value`: The attribute of the users LDAP record containing the user name. - `update-ldap`: Update existing LDAP (via Bind DN) authentication source
- `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name. - Options:
- `--surname-attribute value`: The attribute of the users LDAP record containing the users surname. - `--id value`: ID of authentication source. Required.
- `--email-attribute value`: The attribute of the users LDAP record containing the users email address. Required. - `--name value`: Authentication name.
- `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key. - `--not-active`: Deactivate the authentication source.
- `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user. - `--security-protocol value`: Security protocol name.
- `--bind-password value`: The password for the Bind DN, if any. - `--skip-tls-verify`: Disable TLS verification.
- `--attributes-in-bind`: Fetch attributes in bind DN context. - `--host value`: The address where the LDAP server can be reached.
- `--synchronize-users`: Enable user synchronization. - `--port value`: The port to use when connecting to the LDAP server.
- `--page-size value`: Search page size. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
- Examples: - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate.
- `gitea admin auth add-ldap --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-search-base "ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(uid=%s))" --email-attribute mail` - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
- `update-ldap`: Update existing LDAP (via Bind DN) authentication source - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
- Options: - `--username-attribute value`: The attribute of the users LDAP record containing the user name.
- `--id value`: ID of authentication source. Required. - `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name.
- `--name value`: Authentication name. - `--surname-attribute value`: The attribute of the users LDAP record containing the users surname.
- `--not-active`: Deactivate the authentication source. - `--email-attribute value`: The attribute of the users LDAP record containing the users email address.
- `--security-protocol value`: Security protocol name. - `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key.
- `--skip-tls-verify`: Disable TLS verification. - `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user.
- `--host value`: The address where the LDAP server can be reached. - `--bind-password value`: The password for the Bind DN, if any.
- `--port value`: The port to use when connecting to the LDAP server. - `--attributes-in-bind`: Fetch attributes in bind DN context.
- `--user-search-base value`: The LDAP base at which user accounts will be searched for. - `--synchronize-users`: Enable user synchronization.
- `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. - `--page-size value`: Search page size.
- `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges. - Examples:
- `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status. - `gitea admin auth update-ldap --id 1 --name "my ldap auth source"`
- `--username-attribute value`: The attribute of the users LDAP record containing the user name. - `gitea admin auth update-ldap --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
- `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name. - `add-ldap-simple`: Add new LDAP (simple auth) authentication source
- `--surname-attribute value`: The attribute of the users LDAP record containing the users surname. - Options:
- `--email-attribute value`: The attribute of the users LDAP record containing the users email address. - `--name value`: Authentication name. Required.
- `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key. - `--not-active`: Deactivate the authentication source.
- `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user. - `--security-protocol value`: Security protocol name. Required.
- `--bind-password value`: The password for the Bind DN, if any. - `--skip-tls-verify`: Disable TLS verification.
- `--attributes-in-bind`: Fetch attributes in bind DN context. - `--host value`: The address where the LDAP server can be reached. Required.
- `--synchronize-users`: Enable user synchronization. - `--port value`: The port to use when connecting to the LDAP server. Required.
- `--page-size value`: Search page size. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
- Examples: - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required.
- `gitea admin auth update-ldap --id 1 --name "my ldap auth source"` - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
- `gitea admin auth update-ldap --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn` - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
- `add-ldap-simple`: Add new LDAP (simple auth) authentication source - `--username-attribute value`: The attribute of the users LDAP record containing the user name.
- Options: - `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name.
- `--name value`: Authentication name. Required. - `--surname-attribute value`: The attribute of the users LDAP record containing the users surname.
- `--not-active`: Deactivate the authentication source. - `--email-attribute value`: The attribute of the users LDAP record containing the users email address. Required.
- `--security-protocol value`: Security protocol name. Required. - `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key.
- `--skip-tls-verify`: Disable TLS verification. - `--user-dn value`: The users DN. Required.
- `--host value`: The address where the LDAP server can be reached. Required. - Examples:
- `--port value`: The port to use when connecting to the LDAP server. Required. - `gitea admin auth add-ldap-simple --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-dn "cn=%s,ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(cn=%s))" --email-attribute mail`
- `--user-search-base value`: The LDAP base at which user accounts will be searched for. - `update-ldap-simple`: Update existing LDAP (simple auth) authentication source
- `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required. - Options:
- `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges. - `--id value`: ID of authentication source. Required.
- `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status. - `--name value`: Authentication name.
- `--username-attribute value`: The attribute of the users LDAP record containing the user name. - `--not-active`: Deactivate the authentication source.
- `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name. - `--security-protocol value`: Security protocol name.
- `--surname-attribute value`: The attribute of the users LDAP record containing the users surname. - `--skip-tls-verify`: Disable TLS verification.
- `--email-attribute value`: The attribute of the users LDAP record containing the users email address. Required. - `--host value`: The address where the LDAP server can be reached.
- `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key. - `--port value`: The port to use when connecting to the LDAP server.
- `--user-dn value`: The users DN. Required. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
- Examples: - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate.
- `gitea admin auth add-ldap-simple --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-dn "cn=%s,ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(cn=%s))" --email-attribute mail` - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
- `update-ldap-simple`: Update existing LDAP (simple auth) authentication source - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
- Options: - `--username-attribute value`: The attribute of the users LDAP record containing the user name.
- `--id value`: ID of authentication source. Required. - `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name.
- `--name value`: Authentication name. - `--surname-attribute value`: The attribute of the users LDAP record containing the users surname.
- `--not-active`: Deactivate the authentication source. - `--email-attribute value`: The attribute of the users LDAP record containing the users email address.
- `--security-protocol value`: Security protocol name. - `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key.
- `--skip-tls-verify`: Disable TLS verification. - `--user-dn value`: The users DN.
- `--host value`: The address where the LDAP server can be reached. - Examples:
- `--port value`: The port to use when connecting to the LDAP server. - `gitea admin auth update-ldap-simple --id 1 --name "my ldap auth source"`
- `--user-search-base value`: The LDAP base at which user accounts will be searched for. - `gitea admin auth update-ldap-simple --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
- `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate.
- `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
- `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
- `--username-attribute value`: The attribute of the users LDAP record containing the user name.
- `--firstname-attribute value`: The attribute of the users LDAP record containing the users first name.
- `--surname-attribute value`: The attribute of the users LDAP record containing the users surname.
- `--email-attribute value`: The attribute of the users LDAP record containing the users email address.
- `--public-ssh-key-attribute value`: The attribute of the users LDAP record containing the users public ssh key.
- `--user-dn value`: The users DN.
- Examples:
- `gitea admin auth update-ldap-simple --id 1 --name "my ldap auth source"`
- `gitea admin auth update-ldap-simple --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
### cert ### cert
@ -237,17 +227,17 @@ Generates a self-signed SSL certificate. Outputs to `cert.pem` and `key.pem` in
directory and will overwrite any existing files. directory and will overwrite any existing files.
- Options: - Options:
- `--host value`: Comma seperated hostnames and ips which this certificate is valid for. - `--host value`: Comma seperated hostnames and ips which this certificate is valid for.
Wildcards are supported. Required. Wildcards are supported. Required.
- `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options - `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options
are P224, P256, P384, P521. are P224, P256, P384, P521.
- `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is - `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is
set. (default: 2048). set. (default: 2048).
- `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`). - `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`).
- `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s) - `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s)
- `--ca`: If provided, this cert generates it's own certificate authority. Optional. - `--ca`: If provided, this cert generates it's own certificate authority. Optional.
- Examples: - Examples:
- `gitea cert --host git.example.com,example.com,www.example.com --ca` - `gitea cert --host git.example.com,example.com,www.example.com --ca`
### dump ### dump
@ -255,14 +245,14 @@ Dumps all files and databases into a zip file. Outputs into a file like `gitea-d
in the current directory. in the current directory.
- Options: - Options:
- `--file name`, `-f name`: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip). - `--file name`, `-f name`: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip).
- `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp). - `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp).
- `--skip-repository`, `-R`: Skip the repository dumping. Optional. - `--skip-repository`, `-R`: Skip the repository dumping. Optional.
- `--database`, `-d`: Specify the database SQL syntax. Optional. - `--database`, `-d`: Specify the database SQL syntax. Optional.
- `--verbose`, `-V`: If provided, shows additional details. Optional. - `--verbose`, `-V`: If provided, shows additional details. Optional.
- Examples: - Examples:
- `gitea dump` - `gitea dump`
- `gitea dump --verbose` - `gitea dump --verbose`
### generate ### generate
@ -270,15 +260,15 @@ Generates random values and tokens for usage in configuration file. Useful for g
for automatic deployments. for automatic deployments.
- Commands: - Commands:
- `secret`: - `secret`:
- Options: - Options:
- `INTERNAL_TOKEN`: Token used for an internal API call authentication. - `INTERNAL_TOKEN`: Token used for an internal API call authentication.
- `JWT_SECRET`: LFS & OAUTH2 JWT authentication secret (LFS_JWT_SECRET is aliased to this option for backwards compatibility). - `JWT_SECRET`: LFS & OAUTH2 JWT authentication secret (LFS_JWT_SECRET is aliased to this option for backwards compatibility).
- `SECRET_KEY`: Global secret key. - `SECRET_KEY`: Global secret key.
- Examples: - Examples:
- `gitea generate secret INTERNAL_TOKEN` - `gitea generate secret INTERNAL_TOKEN`
- `gitea generate secret JWT_SECRET` - `gitea generate secret JWT_SECRET`
- `gitea generate secret SECRET_KEY` - `gitea generate secret SECRET_KEY`
### keys ### keys
@ -303,21 +293,24 @@ 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:
- Check if OpenSSH authorized_keys file id correct - Check if OpenSSH authorized_keys file id correct
When your gitea instance support OpenSSH, your gitea instance binary path will be written to `authorized_keys` When your gitea instance support OpenSSH, your gitea instance binary path will be written to `authorized_keys`
when there is any public key added or changed on your gitea instance. when there is any public key added or changed on your gitea instance.
Sometimes if you moved or renamed your gitea binary when upgrade and you haven't run `Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.)` on your Admin Panel. Then all pull/push via SSH will not be work. Sometimes if you moved or renamed your gitea binary when upgrade and you haven't run `Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.)` on your Admin Panel. Then all pull/push via SSH will not be work.
This check will help you to check if it works well. This check will help you to check if it works well.
For contributors, if you want to add more checks, you can wrie ad new function like `func(ctx *cli.Context) ([]string, error)` and For contributors, if you want to add more checks, you can wrie ad new function like `func(ctx *cli.Context) ([]string, error)` and
append it to `doctor.go`. append it to `doctor.go`.
@ -369,24 +362,24 @@ It is highly recommended to back-up your database before running these commands.
Manage running server operations: Manage running server operations:
- Commands: - Commands:
- `shutdown`: Gracefully shutdown the running process - `shutdown`: Gracefully shutdown the running process
- `restart`: Gracefully restart the running process - (not implemented for windows servers) - `restart`: Gracefully restart the running process - (not implemented for windows servers)
- `flush-queues`: Flush queues in the running process - `flush-queues`: Flush queues in the running process
- Options: - Options:
- `--timeout value`: Timeout for the flushing process (default: 1m0s) - `--timeout value`: Timeout for the flushing process (default: 1m0s)
- `--non-blocking`: Set to true to not wait for flush to complete before returning - `--non-blocking`: Set to true to not wait for flush to complete before returning
- `logging`: Adjust logging commands - `logging`: Adjust logging commands
- Commands: - Commands:
- `pause`: Pause logging - `pause`: Pause logging
- Notes: - Notes:
- The logging level will be raised to INFO temporarily if it is below this level. - The logging level will be raised to INFO temporarily if it is below this level.
- Gitea will buffer logs up to a certain point and will drop them after that point. - Gitea will buffer logs up to a certain point and will drop them after that point.
- `resume`: Resume logging - `resume`: Resume logging
- `release-and-reopen`: Cause Gitea to release and re-open files and connections used for logging (Equivalent to sending SIGUSR1 to Gitea.) - `release-and-reopen`: Cause Gitea to release and re-open files and connections used for logging (Equivalent to sending SIGUSR1 to Gitea.)
- `remove name`: Remove the named logger - `remove name`: Remove the named logger
- Options: - Options:
- `--group group`, `-g group`: Set the group to remove the sublogger from. (defaults to `default`) - `--group group`, `-g group`: Set the group to remove the sublogger from. (defaults to `default`)
- `add`: Add a logger - `add`: Add a logger
- Commands: - Commands:
- `console`: Add a console logger - `console`: Add a console logger
- Options: - Options:
@ -402,7 +395,7 @@ Manage running server operations:
- `file`: Add a file logger - `file`: Add a file logger
- Options: - Options:
- `--group value`, `-g value`: Group to add logger to - will default to "default" - `--group value`, `-g value`: Group to add logger to - will default to "default"
- `--name value`, `-n value`: Name of the new logger - will default to mode - `--name value`, `-n value`: Name of the new logger - will default to mode
- `--level value`, `-l value`: Logging level for the new logger - `--level value`, `-l value`: Logging level for the new logger
- `--stacktrace-level value`, `-L value`: Stacktrace logging level - `--stacktrace-level value`, `-L value`: Stacktrace logging level
- `--flags value`, `-F value`: Flags for the logger - `--flags value`, `-F value`: Flags for the logger
@ -419,7 +412,7 @@ Manage running server operations:
- `conn`: Add a network connection logger - `conn`: Add a network connection logger
- Options: - Options:
- `--group value`, `-g value`: Group to add logger to - will default to "default" - `--group value`, `-g value`: Group to add logger to - will default to "default"
- `--name value`, `-n value`: Name of the new logger - will default to mode - `--name value`, `-n value`: Name of the new logger - will default to mode
- `--level value`, `-l value`: Logging level for the new logger - `--level value`, `-l value`: Logging level for the new logger
- `--stacktrace-level value`, `-L value`: Stacktrace logging level - `--stacktrace-level value`, `-L value`: Stacktrace logging level
- `--flags value`, `-F value`: Flags for the logger - `--flags value`, `-F value`: Flags for the logger

@ -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 systems sendmail command instead of SMTP. This is common on Linux servers. Use the operating systems 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
- "help needed" - bug
----- - "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
@ -172,26 +174,26 @@ This table illustrates the different kinds of cross-reference for issues and pul
In the examples, `User1/Repo1` refers to the repository where the reference is used, while In the examples, `User1/Repo1` refers to the repository where the reference is used, while
`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` |
| `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | | `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` |
| `User1/Repo1#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | | `User1/Repo1#1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` |
| `User1/Repo1!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` | | `User1/Repo1!1234` | no | N/A | A link to issue/pull 1234 in `User1/Repo1` |
| `User1/Repo1#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` | | `User1/Repo1#1234` | yes | N/A | A link to _external issue_ 1234 for `User1/Repo1` |
| `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | | `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` |
| `UserZ/RepoZ#1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` | | `UserZ/RepoZ#1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` |
| `UserZ/RepoZ!1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` | | `UserZ/RepoZ!1234` | N/A | no | A link to issue/pull 1234 in `UserZ/RepoZ` |
| `UserZ/RepoZ#1234` | N/A | yes | A link to _external issue_ 1234 for `UserZ/RepoZ` | | `UserZ/RepoZ#1234` | N/A | yes | A link to _external issue_ 1234 for `UserZ/RepoZ` |
| `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 for `UserZ/RepoZ` | | `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 for `UserZ/RepoZ` |
| **Alphanumeric issue IDs:** | - | - | - | | **Alphanumeric issue IDs:** | - | - | - |
| `AAA-1234` | yes | N/A | A link to _external issue_ `AAA-1234` for `User1/Repo1` | | `AAA-1234` | yes | N/A | A link to _external issue_ `AAA-1234` for `User1/Repo1` |
| `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | | `!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` |
| `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` | | `User1/Repo1!1234` | yes | N/A | A link to _PR_ 1234 for `User1/Repo1` |
| _Not supported_ | N/A | yes | A link to _external issue_ `AAA-1234` for `UserZ/RepoZ` | | _Not supported_ | N/A | yes | A link to _external issue_ `AAA-1234` for `UserZ/RepoZ` |
| `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 in `UserZ/RepoZ` | | `UserZ/RepoZ!1234` | N/A | yes | A link to _PR_ 1234 in `UserZ/RepoZ` |
_The last section is for repositories with external issue trackers that use alphanumeric format._ _The last section is for repositories with external issue trackers that use alphanumeric format._

@ -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;
@ -48,7 +51,8 @@ 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.
@ -56,20 +60,20 @@ The front page, a repository view or issue list is dynamic content.
Nginx can serve static resources directly and proxy only the dynamic requests to gitea. Nginx can serve static resources directly and proxy only the dynamic requests to gitea.
Nginx is optimized for serving static content, while the proxying of large responses might be the opposite of that Nginx is optimized for serving static content, while the proxying of large responses might be the opposite of that
(see https://serverfault.com/q/587386). (see https://serverfault.com/q/587386).
Download a snapshot of the Gitea source repository to `/path/to/gitea/`. Download a snapshot of the Gitea source repository to `/path/to/gitea/`.
After this, run `make frontend` in the repository directory to generate the static resources. We are only interested in the `public/` directory for this task, so you can delete the rest. After this, run `make frontend` in the repository directory to generate the static resources. We are only interested in the `public/` directory for this task, so you can delete the rest.
(You will need to have [Node with npm](https://nodejs.org/en/download/) and `make` installed to generate the static resources) (You will need to have [Node with npm](https://nodejs.org/en/download/) and `make` installed to generate the static resources)
Depending on the scale of your user base, you might want to split the traffic to two distinct servers, Depending on the scale of your user base, you might want to split the traffic to two distinct servers,
or use a cdn for the static files. or use a cdn for the static files.
### Single node and single domain ### Single node and single domain
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,14 +208,15 @@ 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)
- Once the module is installed in IIS, you will see a new Icon in the IIS Administration Console called URL Rewrite. - 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)
- 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. - Once the module is installed in IIS, you will see a new Icon in the IIS Administration Console called URL Rewrite.
- Choose the `Add Rule` action from the right pane of the management console and select the `Reverse Proxy Rule` from the `Inbound and Outbound Rules` category. - 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.
- In the Inbound Rules section, set the server name to be the host that Gitea is running on with its port. e.g. if you are running Gitea on the localhost with port 3000, the following should work: `127.0.0.1:3000` - Choose the `Add Rule` action from the right pane of the management console and select the `Reverse Proxy Rule` from the `Inbound and Outbound Rules` category.
- Enable SSL Offloading - In the Inbound Rules section, set the server name to be the host that Gitea is running on with its port. e.g. if you are running Gitea on the localhost with port 3000, the following should work: `127.0.0.1:3000`
- In the Outbound Rules, ensure `Rewrite the domain names of the links in HTTP response` is set and set the `From:` field as above and the `To:` to your external hostname, say: `git.example.com` - Enable SSL Offloading
- Now edit the `web.config` for your website to match the following: (changing `127.0.0.1:3000` and `git.example.com` as appropriate) - In the Outbound Rules, ensure `Rewrite the domain names of the links in HTTP response` is set and set the `From:` field as above and the `To:` to your external hostname, say: `git.example.com`
- Now edit the `web.config` for your website to match the following: (changing `127.0.0.1:3000` and `git.example.com` as appropriate)
```xml ```xml
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>

@ -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,18 +63,19 @@ 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 |
| PASCAL | GoSdk | | PASCAL | GoSdk |
| LOWER | go-sdk | | LOWER | go-sdk |
| UPPER | GO-SDK | | UPPER | GO-SDK |
| TITLE | Go-Sdk | | TITLE | Go-Sdk |

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