You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

command-line.en-us.md 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. ---
  2. date: "2017-01-01T16:00:00+02:00"
  3. title: "Usage: Command Line"
  4. slug: "command-line"
  5. weight: 10
  6. toc: false
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "usage"
  11. name: "Command Line"
  12. weight: 10
  13. identifier: "command-line"
  14. ---
  15. # Command Line
  16. **Table of Contents**
  17. {{< toc >}}
  18. ## Usage
  19. `gitea [global options] command [command or global options] [arguments...]`
  20. ## Global options
  21. All global options can be placed at the command level.
  22. - `--help`, `-h`: Show help text and exit. Optional.
  23. - `--version`, `-v`: Show version and exit. Optional. (example: `Gitea version 1.1.0+218-g7b907ed built with: bindata, sqlite`).
  24. - `--custom-path path`, `-C path`: Location of the Gitea custom folder. Optional. (default: `AppWorkPath`/custom or `$GITEA_CUSTOM`).
  25. - `--config path`, `-c path`: Gitea configuration file path. Optional. (default: `custom`/conf/app.ini).
  26. - `--work-path path`, `-w path`: Gitea `AppWorkPath`. Optional. (default: LOCATION_OF_GITEA_BINARY or `$GITEA_WORK_DIR`)
  27. NB: The defaults custom-path, config and work-path can also be
  28. changed at build time (if preferred).
  29. ## Commands
  30. ### web
  31. Starts the server:
  32. - Options:
  33. - `--port number`, `-p number`: Port number. Optional. (default: 3000). Overrides configuration file.
  34. - `--install-port number`: Port number to run the install page on. Optional. (default: 3000). Overrides configuration file.
  35. - `--pid path`, `-P path`: Pidfile path. Optional.
  36. - `--quiet`, `-q`: Only emit Fatal logs on the console for logs emitted before logging set up.
  37. - `--verbose`: Emit tracing logs on the console for logs emitted before logging is set-up.
  38. - Examples:
  39. - `gitea web`
  40. - `gitea web --port 80`
  41. - `gitea web --config /etc/gitea.ini --pid /some/custom/gitea.pid`
  42. - Notes:
  43. - Gitea should not be run as root. To bind to a port below 1024, you can use setcap on
  44. Linux: `sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`. This will need to be
  45. redone every time you update Gitea.
  46. ### admin
  47. Admin operations:
  48. - Commands:
  49. - `user`:
  50. - `list`:
  51. - Options:
  52. - `--admin`: List only admin users. Optional.
  53. - Description: lists all users that exist
  54. - Examples:
  55. - `gitea admin user list`
  56. - `delete`:
  57. - Options:
  58. - `--email`: Email of the user to be deleted.
  59. - `--username`: Username of user to be deleted.
  60. - `--id`: ID of user to be deleted.
  61. - One of `--id`, `--username` or `--email` is required. If more than one is provided then all have to match.
  62. - Examples:
  63. - `gitea admin user delete --id 1`
  64. - `create`:
  65. - Options:
  66. - `--name value`: Username. Required. As of Gitea 1.9.0, use the `--username` flag instead.
  67. - `--username value`: Username. Required. New in Gitea 1.9.0.
  68. - `--password value`: Password. Required.
  69. - `--email value`: Email. Required.
  70. - `--admin`: If provided, this makes the user an admin. Optional.
  71. - `--access-token`: If provided, an access token will be created for the user. Optional. (default: false).
  72. - `--must-change-password`: If provided, the created user will be required to choose a newer password after the
  73. initial login. Optional. (default: true).
  74. - `--random-password`: If provided, a randomly generated password will be used as the password of the created
  75. user. The value of `--password` will be discarded. Optional.
  76. - `--random-password-length`: If provided, it will be used to configure the length of the randomly generated
  77. password. Optional. (default: 12)
  78. - Examples:
  79. - `gitea admin user create --username myname --password asecurepassword --email me@example.com`
  80. - `change-password`:
  81. - Options:
  82. - `--username value`, `-u value`: Username. Required.
  83. - `--password value`, `-p value`: New password. Required.
  84. - Examples:
  85. - `gitea admin user change-password --username myname --password asecurepassword`
  86. - `regenerate`
  87. - Options:
  88. - `hooks`: Regenerate Git Hooks for all repositories
  89. - `keys`: Regenerate authorized_keys file
  90. - Examples:
  91. - `gitea admin regenerate hooks`
  92. - `gitea admin regenerate keys`
  93. - `auth`:
  94. - `list`:
  95. - Description: lists all external authentication sources that exist
  96. - Examples:
  97. - `gitea admin auth list`
  98. - `delete`:
  99. - Options:
  100. - `--id`: ID of source to be deleted. Required.
  101. - Examples:
  102. - `gitea admin auth delete --id 1`
  103. - `add-oauth`:
  104. - Options:
  105. - `--name`: Application Name.
  106. - `--provider`: OAuth2 Provider.
  107. - `--key`: Client ID (Key).
  108. - `--secret`: Client Secret.
  109. - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
  110. - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
  111. - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
  112. - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
  113. - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
  114. - `--custom-email-url`: Use a custom Email URL (option for GitHub).
  115. - `--icon-url`: Custom icon URL for OAuth2 login source.
  116. - `--skip-local-2fa`: Allow source to override local 2FA. (Optional)
  117. - `--scopes`: Additional scopes to request for this OAuth2 source. (Optional)
  118. - `--required-claim-name`: Claim name that has to be set to allow users to login with this source. (Optional)
  119. - `--required-claim-value`: Claim value that has to be set to allow users to login with this source. (Optional)
  120. - `--group-claim-name`: Claim name providing group names for this source. (Optional)
  121. - `--admin-group`: Group Claim value for administrator users. (Optional)
  122. - `--restricted-group`: Group Claim value for restricted users. (Optional)
  123. - Examples:
  124. - `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
  125. - `update-oauth`:
  126. - Options:
  127. - `--id`: ID of source to be updated. Required.
  128. - `--name`: Application Name.
  129. - `--provider`: OAuth2 Provider.
  130. - `--key`: Client ID (Key).
  131. - `--secret`: Client Secret.
  132. - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
  133. - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
  134. - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
  135. - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
  136. - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
  137. - `--custom-email-url`: Use a custom Email URL (option for GitHub).
  138. - `--icon-url`: Custom icon URL for OAuth2 login source.
  139. - `--skip-local-2fa`: Allow source to override local 2FA. (Optional)
  140. - `--scopes`: Additional scopes to request for this OAuth2 source.
  141. - `--required-claim-name`: Claim name that has to be set to allow users to login with this source. (Optional)
  142. - `--required-claim-value`: Claim value that has to be set to allow users to login with this source. (Optional)
  143. - `--group-claim-name`: Claim name providing group names for this source. (Optional)
  144. - `--admin-group`: Group Claim value for administrator users. (Optional)
  145. - `--restricted-group`: Group Claim value for restricted users. (Optional)
  146. - Examples:
  147. - `gitea admin auth update-oauth --id 1 --name external-github-updated`
  148. - `add-smtp`:
  149. - Options:
  150. - `--name`: Application Name. Required.
  151. - `--auth-type`: SMTP Authentication Type (PLAIN/LOGIN/CRAM-MD5). Default to PLAIN.
  152. - `--host`: SMTP host. Required.
  153. - `--port`: SMTP port. Required.
  154. - `--force-smtps`: SMTPS is always used on port 465. Set this to force SMTPS on other ports.
  155. - `--skip-verify`: Skip TLS verify.
  156. - `--helo-hostname`: Hostname sent with HELO. Leave blank to send current hostname.
  157. - `--disable-helo`: Disable SMTP helo.
  158. - `--allowed-domains`: Leave empty to allow all domains. Separate multiple domains with a comma (',').
  159. - `--skip-local-2fa`: Skip 2FA to log on.
  160. - `--active`: This Authentication Source is Activated.
  161. Remarks:
  162. `--force-smtps`, `--skip-verify`, `--disable-helo`, `--skip-loca-2fs` and `--active` options can be used in form:
  163. - `--option`, `--option=true` to enable
  164. - `--option=false` to disable
  165. If those options are not specified value would not be changed in `update-smtp` or would use default `false` value in `add-smtp`
  166. - Examples:
  167. - `gitea admin auth add-smtp --name ldap --host smtp.mydomain.org --port 587 --skip-verify --active`
  168. - `update-smtp`:
  169. - Options:
  170. - `--id`: ID of source to be updated. Required.
  171. - other options are shared with `add-smtp`
  172. - Examples:
  173. - `gitea admin auth update-smtp --id 1 --host smtp.mydomain.org --port 587 --skip-verify=false`
  174. - `gitea admin auth update-smtp --id 1 --active=false`
  175. - `add-ldap`: Add new LDAP (via Bind DN) authentication source
  176. - Options:
  177. - `--name value`: Authentication name. Required.
  178. - `--not-active`: Deactivate the authentication source.
  179. - `--security-protocol value`: Security protocol name. Required.
  180. - `--skip-tls-verify`: Disable TLS verification.
  181. - `--host value`: The address where the LDAP server can be reached. Required.
  182. - `--port value`: The port to use when connecting to the LDAP server. Required.
  183. - `--user-search-base value`: The LDAP base at which user accounts will be searched for. Required.
  184. - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required.
  185. - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
  186. - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
  187. - `--username-attribute value`: The attribute of the user’s LDAP record containing the user name.
  188. - `--firstname-attribute value`: The attribute of the user’s LDAP record containing the user’s first name.
  189. - `--surname-attribute value`: The attribute of the user’s LDAP record containing the user’s surname.
  190. - `--email-attribute value`: The attribute of the user’s LDAP record containing the user’s email address. Required.
  191. - `--public-ssh-key-attribute value`: The attribute of the user’s LDAP record containing the user’s public ssh key.
  192. - `--avatar-attribute value`: The attribute of the user’s LDAP record containing the user’s avatar.
  193. - `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user.
  194. - `--bind-password value`: The password for the Bind DN, if any.
  195. - `--attributes-in-bind`: Fetch attributes in bind DN context.
  196. - `--synchronize-users`: Enable user synchronization.
  197. - `--page-size value`: Search page size.
  198. - Examples:
  199. - `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`
  200. - `update-ldap`: Update existing LDAP (via Bind DN) authentication source
  201. - Options:
  202. - `--id value`: ID of authentication source. Required.
  203. - `--name value`: Authentication name.
  204. - `--not-active`: Deactivate the authentication source.
  205. - `--security-protocol value`: Security protocol name.
  206. - `--skip-tls-verify`: Disable TLS verification.
  207. - `--host value`: The address where the LDAP server can be reached.
  208. - `--port value`: The port to use when connecting to the LDAP server.
  209. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
  210. - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate.
  211. - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
  212. - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
  213. - `--username-attribute value`: The attribute of the user’s LDAP record containing the user name.
  214. - `--firstname-attribute value`: The attribute of the user’s LDAP record containing the user’s first name.
  215. - `--surname-attribute value`: The attribute of the user’s LDAP record containing the user’s surname.
  216. - `--email-attribute value`: The attribute of the user’s LDAP record containing the user’s email address.
  217. - `--public-ssh-key-attribute value`: The attribute of the user’s LDAP record containing the user’s public ssh key.
  218. - `--avatar-attribute value`: The attribute of the user’s LDAP record containing the user’s avatar.
  219. - `--bind-dn value`: The DN to bind to the LDAP server with when searching for the user.
  220. - `--bind-password value`: The password for the Bind DN, if any.
  221. - `--attributes-in-bind`: Fetch attributes in bind DN context.
  222. - `--synchronize-users`: Enable user synchronization.
  223. - `--page-size value`: Search page size.
  224. - Examples:
  225. - `gitea admin auth update-ldap --id 1 --name "my ldap auth source"`
  226. - `gitea admin auth update-ldap --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
  227. - `add-ldap-simple`: Add new LDAP (simple auth) authentication source
  228. - Options:
  229. - `--name value`: Authentication name. Required.
  230. - `--not-active`: Deactivate the authentication source.
  231. - `--security-protocol value`: Security protocol name. Required.
  232. - `--skip-tls-verify`: Disable TLS verification.
  233. - `--host value`: The address where the LDAP server can be reached. Required.
  234. - `--port value`: The port to use when connecting to the LDAP server. Required.
  235. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
  236. - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate. Required.
  237. - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
  238. - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
  239. - `--username-attribute value`: The attribute of the user’s LDAP record containing the user name.
  240. - `--firstname-attribute value`: The attribute of the user’s LDAP record containing the user’s first name.
  241. - `--surname-attribute value`: The attribute of the user’s LDAP record containing the user’s surname.
  242. - `--email-attribute value`: The attribute of the user’s LDAP record containing the user’s email address. Required.
  243. - `--public-ssh-key-attribute value`: The attribute of the user’s LDAP record containing the user’s public ssh key.
  244. - `--avatar-attribute value`: The attribute of the user’s LDAP record containing the user’s avatar.
  245. - `--user-dn value`: The user’s DN. Required.
  246. - Examples:
  247. - `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`
  248. - `update-ldap-simple`: Update existing LDAP (simple auth) authentication source
  249. - Options:
  250. - `--id value`: ID of authentication source. Required.
  251. - `--name value`: Authentication name.
  252. - `--not-active`: Deactivate the authentication source.
  253. - `--security-protocol value`: Security protocol name.
  254. - `--skip-tls-verify`: Disable TLS verification.
  255. - `--host value`: The address where the LDAP server can be reached.
  256. - `--port value`: The port to use when connecting to the LDAP server.
  257. - `--user-search-base value`: The LDAP base at which user accounts will be searched for.
  258. - `--user-filter value`: An LDAP filter declaring how to find the user record that is attempting to authenticate.
  259. - `--admin-filter value`: An LDAP filter specifying if a user should be given administrator privileges.
  260. - `--restricted-filter value`: An LDAP filter specifying if a user should be given restricted status.
  261. - `--username-attribute value`: The attribute of the user’s LDAP record containing the user name.
  262. - `--firstname-attribute value`: The attribute of the user’s LDAP record containing the user’s first name.
  263. - `--surname-attribute value`: The attribute of the user’s LDAP record containing the user’s surname.
  264. - `--email-attribute value`: The attribute of the user’s LDAP record containing the user’s email address.
  265. - `--public-ssh-key-attribute value`: The attribute of the user’s LDAP record containing the user’s public ssh key.
  266. - `--avatar-attribute value`: The attribute of the user’s LDAP record containing the user’s avatar.
  267. - `--user-dn value`: The user’s DN.
  268. - Examples:
  269. - `gitea admin auth update-ldap-simple --id 1 --name "my ldap auth source"`
  270. - `gitea admin auth update-ldap-simple --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
  271. ### cert
  272. Generates a self-signed SSL certificate. Outputs to `cert.pem` and `key.pem` in the current
  273. directory and will overwrite any existing files.
  274. - Options:
  275. - `--host value`: Comma separated hostnames and ips which this certificate is valid for.
  276. Wildcards are supported. Required.
  277. - `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options
  278. are P224, P256, P384, P521.
  279. - `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is
  280. set. (default: 2048).
  281. - `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`).
  282. - `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s)
  283. - `--ca`: If provided, this cert generates it's own certificate authority. Optional.
  284. - Examples:
  285. - `gitea cert --host git.example.com,example.com,www.example.com --ca`
  286. ### dump
  287. Dumps all files and databases into a zip file. Outputs into a file like `gitea-dump-1482906742.zip`
  288. in the current directory.
  289. - Options:
  290. - `--file name`, `-f name`: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip).
  291. - `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp).
  292. - `--skip-repository`, `-R`: Skip the repository dumping. Optional.
  293. - `--skip-custom-dir`: Skip dumping of the custom dir. Optional.
  294. - `--skip-lfs-data`: Skip dumping of LFS data. Optional.
  295. - `--skip-attachment-data`: Skip dumping of attachment data. Optional.
  296. - `--skip-package-data`: Skip dumping of package data. Optional.
  297. - `--skip-log`: Skip dumping of log data. Optional.
  298. - `--database`, `-d`: Specify the database SQL syntax. Optional.
  299. - `--verbose`, `-V`: If provided, shows additional details. Optional.
  300. - `--type`: Set the dump output format. Optional. (default: zip)
  301. - Examples:
  302. - `gitea dump`
  303. - `gitea dump --verbose`
  304. ### generate
  305. Generates random values and tokens for usage in configuration file. Useful for generating values
  306. for automatic deployments.
  307. - Commands:
  308. - `secret`:
  309. - Options:
  310. - `INTERNAL_TOKEN`: Token used for an internal API call authentication.
  311. - `JWT_SECRET`: LFS & OAUTH2 JWT authentication secret (LFS_JWT_SECRET is aliased to this option for backwards compatibility).
  312. - `SECRET_KEY`: Global secret key.
  313. - Examples:
  314. - `gitea generate secret INTERNAL_TOKEN`
  315. - `gitea generate secret JWT_SECRET`
  316. - `gitea generate secret SECRET_KEY`
  317. ### keys
  318. Provides an SSHD AuthorizedKeysCommand. Needs to be configured in the sshd config file:
  319. ```ini
  320. ...
  321. # The value of -e and the AuthorizedKeysCommandUser should match the
  322. # username running Gitea
  323. AuthorizedKeysCommandUser git
  324. AuthorizedKeysCommand /path/to/gitea keys -e git -u %u -t %t -k %k
  325. ```
  326. The command will return the appropriate authorized_keys line for the
  327. provided key. You should also set the value
  328. `SSH_CREATE_AUTHORIZED_KEYS_FILE=false` in the `[server]` section of
  329. `app.ini`.
  330. NB: opensshd requires the Gitea program to be owned by root and not
  331. writable by group or others. The program must be specified by an absolute
  332. path.
  333. NB: Gitea must be running for this command to succeed.
  334. ### migrate
  335. Migrates the database. This command can be used to run other commands before starting the server for the first time.
  336. This command is idempotent.
  337. ### convert
  338. Converts an existing MySQL database from utf8 to utf8mb4.
  339. ### doctor
  340. Diagnose the problems of current Gitea instance according the given configuration.
  341. Currently there are a check list below:
  342. - Check if OpenSSH authorized_keys file id correct
  343. When your Gitea instance support OpenSSH, your Gitea instance binary path will be written to `authorized_keys`
  344. when there is any public key added or changed on your Gitea instance.
  345. 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.
  346. This check will help you to check if it works well.
  347. For contributors, if you want to add more checks, you can wrie ad new function like `func(ctx *cli.Context) ([]string, error)` and
  348. append it to `doctor.go`.
  349. ```go
  350. var checklist = []check{
  351. {
  352. title: "Check if OpenSSH authorized_keys file id correct",
  353. f: runDoctorLocationMoved,
  354. },
  355. // more checks please append here
  356. }
  357. ```
  358. This function will receive a command line context and return a list of details about the problems or error.
  359. #### doctor recreate-table
  360. Sometimes when there are migrations the old columns and default values may be left
  361. unchanged in the database schema. This may lead to warning such as:
  362. ```
  363. 2020/08/02 11:32:29 ...rm/session_schema.go:360:Sync2() [W] Table user Column keep_activity_private db default is , struct default is 0
  364. ```
  365. You can cause Gitea to recreate these tables and copy the old data into the new table
  366. with the defaults set appropriately by using:
  367. ```
  368. gitea doctor recreate-table user
  369. ```
  370. You can ask Gitea to recreate multiple tables using:
  371. ```
  372. gitea doctor recreate-table table1 table2 ...
  373. ```
  374. And if you would like Gitea to recreate all tables simply call:
  375. ```
  376. gitea doctor recreate-table
  377. ```
  378. It is highly recommended to back-up your database before running these commands.
  379. ### manager
  380. Manage running server operations:
  381. - Commands:
  382. - `shutdown`: Gracefully shutdown the running process
  383. - `restart`: Gracefully restart the running process - (not implemented for windows servers)
  384. - `flush-queues`: Flush queues in the running process
  385. - Options:
  386. - `--timeout value`: Timeout for the flushing process (default: 1m0s)
  387. - `--non-blocking`: Set to true to not wait for flush to complete before returning
  388. - `logging`: Adjust logging commands
  389. - Commands:
  390. - `pause`: Pause logging
  391. - Notes:
  392. - The logging level will be raised to INFO temporarily if it is below this level.
  393. - Gitea will buffer logs up to a certain point and will drop them after that point.
  394. - `resume`: Resume logging
  395. - `release-and-reopen`: Cause Gitea to release and re-open files and connections used for logging (Equivalent to sending SIGUSR1 to Gitea.)
  396. - `remove name`: Remove the named logger
  397. - Options:
  398. - `--group group`, `-g group`: Set the group to remove the sublogger from. (defaults to `default`)
  399. - `add`: Add a logger
  400. - Commands:
  401. - `console`: Add a console logger
  402. - Options:
  403. - `--group value`, `-g value`: Group to add logger to - will default to "default"
  404. - `--name value`, `-n value`: Name of the new logger - will default to mode
  405. - `--level value`, `-l value`: Logging level for the new logger
  406. - `--stacktrace-level value`, `-L value`: Stacktrace logging level
  407. - `--flags value`, `-F value`: Flags for the logger
  408. - `--expression value`, `-e value`: Matching expression for the logger
  409. - `--prefix value`, `-p value`: Prefix for the logger
  410. - `--color`: Use color in the logs
  411. - `--stderr`: Output console logs to stderr - only relevant for console
  412. - `file`: Add a file logger
  413. - Options:
  414. - `--group value`, `-g value`: Group to add logger to - will default to "default"
  415. - `--name value`, `-n value`: Name of the new logger - will default to mode
  416. - `--level value`, `-l value`: Logging level for the new logger
  417. - `--stacktrace-level value`, `-L value`: Stacktrace logging level
  418. - `--flags value`, `-F value`: Flags for the logger
  419. - `--expression value`, `-e value`: Matching expression for the logger
  420. - `--prefix value`, `-p value`: Prefix for the logger
  421. - `--color`: Use color in the logs
  422. - `--filename value`, `-f value`: Filename for the logger -
  423. - `--rotate`, `-r`: Rotate logs
  424. - `--max-size value`, `-s value`: Maximum size in bytes before rotation
  425. - `--daily`, `-d`: Rotate logs daily
  426. - `--max-days value`, `-D value`: Maximum number of daily logs to keep
  427. - `--compress`, `-z`: Compress rotated logs
  428. - `--compression-level value`, `-Z value`: Compression level to use
  429. - `conn`: Add a network connection logger
  430. - Options:
  431. - `--group value`, `-g value`: Group to add logger to - will default to "default"
  432. - `--name value`, `-n value`: Name of the new logger - will default to mode
  433. - `--level value`, `-l value`: Logging level for the new logger
  434. - `--stacktrace-level value`, `-L value`: Stacktrace logging level
  435. - `--flags value`, `-F value`: Flags for the logger
  436. - `--expression value`, `-e value`: Matching expression for the logger
  437. - `--prefix value`, `-p value`: Prefix for the logger
  438. - `--color`: Use color in the logs
  439. - `--reconnect-on-message`, `-R`: Reconnect to host for every message
  440. - `--reconnect`, `-r`: Reconnect to host when connection is dropped
  441. - `--protocol value`, `-P value`: Set protocol to use: tcp, unix, or udp (defaults to tcp)
  442. - `--address value`, `-a value`: Host address and port to connect to (defaults to :7020)
  443. - `smtp`: Add an SMTP logger
  444. - Options:
  445. - `--group value`, `-g value`: Group to add logger to - will default to "default"
  446. - `--name value`, `-n value`: Name of the new logger - will default to mode
  447. - `--level value`, `-l value`: Logging level for the new logger
  448. - `--stacktrace-level value`, `-L value`: Stacktrace logging level
  449. - `--flags value`, `-F value`: Flags for the logger
  450. - `--expression value`, `-e value`: Matching expression for the logger
  451. - `--prefix value`, `-p value`: Prefix for the logger
  452. - `--color`: Use color in the logs
  453. - `--username value`, `-u value`: Mail server username
  454. - `--password value`, `-P value`: Mail server password
  455. - `--host value`, `-H value`: Mail server host (defaults to: 127.0.0.1:25)
  456. - `--send-to value`, `-s value`: Email address(es) to send to
  457. - `--subject value`, `-S value`: Subject header of sent emails
  458. - `processes`: Display Gitea processes and goroutine information
  459. - Options:
  460. - `--flat`: Show processes as flat table rather than as tree
  461. - `--no-system`: Do not show system processes
  462. - `--stacktraces`: Show stacktraces for goroutines associated with processes
  463. - `--json`: Output as json
  464. - `--cancel PID`: Send cancel to process with PID. (Only for non-system processes.)
  465. ### dump-repo
  466. Dump-repo dumps repository data from Git/GitHub/Gitea/GitLab:
  467. - Options:
  468. - `--git_service service` : Git service, it could be `git`, `github`, `gitea`, `gitlab`, If clone_addr could be recognized, this could be ignored.
  469. - `--repo_dir dir`, `-r dir`: Repository dir path to store the data
  470. - `--clone_addr addr`: The URL will be clone, currently could be a git/github/gitea/gitlab http/https URL. i.e. https://github.com/lunny/tango.git
  471. - `--auth_username lunny`: The username to visit the clone_addr
  472. - `--auth_password <password>`: The password to visit the clone_addr
  473. - `--auth_token <token>`: The personal token to visit the clone_addr
  474. - `--owner_name lunny`: The data will be stored on a directory with owner name if not empty
  475. - `--repo_name tango`: The data will be stored on a directory with repository name if not empty
  476. - `--units <units>`: Which items will be migrated, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.
  477. ### restore-repo
  478. Restore-repo restore repository data from disk dir:
  479. - Options:
  480. - `--repo_dir dir`, `-r dir`: Repository dir path to restore from
  481. - `--owner_name lunny`: Restore destination owner name
  482. - `--repo_name tango`: Restore destination repository name
  483. - `--units <units>`: Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.