Skip to content

Commit cfed3be

Browse files
authored
Merge branch 'master' into ui-migration-cancel
2 parents f7e9022 + d8c2c6c commit cfed3be

File tree

125 files changed

+1058
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1058
-1141
lines changed

Makefile

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,15 @@ clean:
223223

224224
.PHONY: fmt
225225
fmt:
226-
$(GOFMT) -w $(GO_SOURCES_OWN)
226+
@echo "Running go fmt..."
227+
@$(GOFMT) -w $(GO_SOURCES_OWN)
227228

228229
.PHONY: vet
229230
vet:
230-
# Default vet
231-
$(GO) vet $(GO_PACKAGES)
232-
# Custom vet
233-
$(GO) build -mod=vendor code.gitea.io/gitea-vet
234-
$(GO) vet -vettool=gitea-vet $(GO_PACKAGES)
231+
@echo "Running go vet..."
232+
@$(GO) vet $(GO_PACKAGES)
233+
@$(GO) build -mod=vendor code.gitea.io/gitea-vet
234+
@$(GO) vet -vettool=gitea-vet $(GO_PACKAGES)
235235

236236
.PHONY: $(TAGS_EVIDENCE)
237237
$(TAGS_EVIDENCE):
@@ -268,7 +268,8 @@ errcheck:
268268
@hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
269269
GO111MODULE=off $(GO) get -u github.com/kisielk/errcheck; \
270270
fi
271-
errcheck $(GO_PACKAGES)
271+
@echo "Running errcheck..."
272+
@errcheck $(GO_PACKAGES)
272273

273274
.PHONY: revive
274275
revive:
@@ -279,14 +280,16 @@ misspell-check:
279280
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
280281
GO111MODULE=off $(GO) get -u github.com/client9/misspell/cmd/misspell; \
281282
fi
282-
misspell -error -i unknwon,destory $(GO_SOURCES_OWN)
283+
@echo "Running misspell-check..."
284+
@misspell -error -i unknwon,destory $(GO_SOURCES_OWN)
283285

284286
.PHONY: misspell
285287
misspell:
286288
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
287289
GO111MODULE=off $(GO) get -u github.com/client9/misspell/cmd/misspell; \
288290
fi
289-
misspell -w -i unknwon $(GO_SOURCES_OWN)
291+
@echo "Running go misspell..."
292+
@misspell -w -i unknwon $(GO_SOURCES_OWN)
290293

291294
.PHONY: fmt-check
292295
fmt-check:
@@ -336,11 +339,12 @@ watch-backend: go-check
336339

337340
.PHONY: test
338341
test:
339-
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES)
342+
@echo "Running go test..."
343+
@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES)
340344

341345
.PHONY: test-check
342346
test-check:
343-
@echo "Checking if tests have changed the source tree...";
347+
@echo "Running test-check...";
344348
@diff=$$(git status -s); \
345349
if [ -n "$$diff" ]; then \
346350
echo "make test has changed files in the source tree:"; \
@@ -352,15 +356,17 @@ test-check:
352356

353357
.PHONY: test\#%
354358
test\#%:
355-
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $(subst .,/,$*) $(GO_PACKAGES)
359+
@echo "Running go test..."
360+
@$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $(subst .,/,$*) $(GO_PACKAGES)
356361

357362
.PHONY: coverage
358363
coverage:
359364
GO111MODULE=on $(GO) run -mod=vendor build/gocovmerge.go integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all
360365

361366
.PHONY: unit-test-coverage
362367
unit-test-coverage:
363-
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
368+
@echo "Running unit-test-coverage..."
369+
@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
364370

365371
.PHONY: vendor
366372
vendor:
@@ -548,7 +554,8 @@ backend: go-check generate $(EXECUTABLE)
548554

549555
.PHONY: generate
550556
generate: $(TAGS_PREREQ)
551-
CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
557+
@echo "Running go generate..."
558+
@CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)
552559

553560
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
554561
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@

docs/content/doc/help/faq.en-us.md

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,42 @@ menu:
1313
identifier: "faq"
1414
---
1515

16-
# Frequently Asked Questions
16+
# Frequently Asked Questions <!-- omit in toc -->
1717

1818
This page contains some common questions and answers.
1919
Also see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}})
2020

21-
* [Difference between 1.x and 1.x.x downloads](#difference-between-1-x-and-1-x-x-downloads)
22-
* [How to migrate from Gogs/GitHub/etc. to Gitea](#how-to-migrate-from-gogs-github-etc-to-gitea)
23-
* [Where does Gitea store "x" file](#where-does-gitea-store-x-file)
24-
* [Not seeing a clone URL or the clone URL being incorrect](#not-seeing-a-clone-url-or-the-clone-url-being-incorrect)
25-
* [Custom Templates not loading or working incorrectly](#custom-templates-not-loading-or-working-incorrectly)
26-
* [Active user vs login prohibited user](#active-user-vs-login-prohibited-user)
27-
* [Setting up logging](#setting-up-logging)
28-
* [What is Swagger?](#what-is-swagger)
29-
* [Adjusting your server for public/private use](#adjusting-your-server-for-public-private-use)
30-
* [Preventing spammers](#preventing-spammers)
31-
* [Only allow certain email domains](#only-allow-certain-email-domains)
32-
* [Only allow/block certain OpenID providers](#only-allow-block-certain-openid-providers)
33-
* [Issue only users](#issue-only-users)
34-
* [Restricted users](#restricted-users)
35-
* [Enable Fail2ban](#enable-fail2ban)
36-
* [Adding custom themes](#how-to-add-use-custom-themes)
37-
* [SSHD vs built-in SSH](#sshd-vs-built-in-ssh)
38-
* [Gitea is running slow](#gitea-is-running-slow)
39-
* [Can't create repositories/files](#cant-create-repositories-files)
40-
* [Translation is incorrect/how to add more translations](#translation-is-incorrect-how-to-add-more-translations)
41-
* [Hooks aren't running](#hooks-aren-t-running)
42-
* [SSH Issues](#ssh-issues)
43-
* [SSH Common Errors](#ssh-common-errors)
44-
* [Missing releases after migration repository with tags](#missing-releases-after-migrating-repository-with-tags)
45-
* [LFS Issues](#lfs-issues)
46-
* [How can I create users before starting Gitea](#how-can-i-create-users-before-starting-gitea)
47-
* [How can I enable password reset](#how-can-i-enable-password-reset)
48-
* [How can a user's password be changed](#how-can-a-user-s-password-be-changed)
49-
* [Why is my markdown broken](#why-is-my-markdown-broken)
50-
* [Errors during upgrade on MySQL: Error 1118: Row size too large.](#upgrade-errors-with-mysql)
51-
* [Why are emoji broken on MySQL](#why-are-emoji-broken-on-mysql)
21+
- [Difference between 1.x and 1.x.x downloads](#difference-between-1x-and-1xx-downloads)
22+
- [How to migrate from Gogs/GitHub/etc. to Gitea](#how-to-migrate-from-gogsgithubetc-to-gitea)
23+
- [Where does Gitea store what file](#where-does-gitea-store-what-file)
24+
- [Not seeing a clone URL or the clone URL being incorrect](#not-seeing-a-clone-url-or-the-clone-url-being-incorrect)
25+
- [Custom Templates not loading or working incorrectly](#custom-templates-not-loading-or-working-incorrectly)
26+
- [Active user vs login prohibited user](#active-user-vs-login-prohibited-user)
27+
- [Setting up logging](#setting-up-logging)
28+
- [What is Swagger?](#what-is-swagger)
29+
- [Adjusting your server for public/private use](#adjusting-your-server-for-publicprivate-use)
30+
- [Preventing spammers](#preventing-spammers)
31+
- [Only allow certain email domains](#only-allow-certain-email-domains)
32+
- [Only allow/block certain OpenID providers](#only-allowblock-certain-openid-providers)
33+
- [Issue only users](#issue-only-users)
34+
- [Restricted users](#restricted-users)
35+
- [Enable Fail2ban](#enable-fail2ban)
36+
- [How to add/use custom themes](#how-to-adduse-custom-themes)
37+
- [SSHD vs built-in SSH](#sshd-vs-built-in-ssh)
38+
- [Gitea is running slow](#gitea-is-running-slow)
39+
- [Can't create repositories/files](#cant-create-repositoriesfiles)
40+
- [Translation is incorrect/how to add more translations](#translation-is-incorrecthow-to-add-more-translations)
41+
- [Hooks aren't running](#hooks-arent-running)
42+
- [SSH issues](#ssh-issues)
43+
- [SSH Common Errors](#ssh-common-errors)
44+
- [Missing releases after migrating repository with tags](#missing-releases-after-migrating-repository-with-tags)
45+
- [LFS Issues](#lfs-issues)
46+
- [How can I create users before starting Gitea](#how-can-i-create-users-before-starting-gitea)
47+
- [How can I enable password reset](#how-can-i-enable-password-reset)
48+
- [How can a user's password be changed](#how-can-a-users-password-be-changed)
49+
- [Why is my markdown broken](#why-is-my-markdown-broken)
50+
- [Upgrade errors with MySQL](#upgrade-errors-with-mysql)
51+
- [Why Are Emoji Broken On MySQL](#why-are-emoji-broken-on-mysql)
5252

5353
## Difference between 1.x and 1.x.x downloads
5454
Version 1.7.x will be used for this example.
@@ -74,7 +74,7 @@ In order to migrate items such as issues, pull requests, etc. you will need to i
7474
To migrate from Gitlab to Gitea, you can use this non-affiliated tool:
7575
https://github.com/loganinak/MigrateGitlabToGogs
7676

77-
## Where does Gitea store "x" file
77+
## Where does Gitea store what file
7878
* WorkPath
7979
* Environment variable `GITEA_WORK_DIR`
8080
* Else binary location
@@ -336,3 +336,7 @@ for the database_name and run `ALTER TABLE table_name CONVERT TO CHARACTER SET u
336336
for each table in the database.
337337

338338
You will also need to change the app.ini database charset to `CHARSET=utf8mb4`.
339+
340+
## Why are Emoji displaying only as placeholders or in monochrome
341+
342+
Gitea requires the system or browser to have one of the supported Emoji fonts installed, which are Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji and Twemoji Mozilla. Generally, the operating system should already provide one of these fonts, but especially on Linux, it may be necessary to install them manually.

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 41 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ files; for named volumes, this is done through another container or by direct ac
291291
:exclamation::exclamation: **Make sure you have volumed data to somewhere outside Docker container** :exclamation::exclamation:
292292

293293
To upgrade your installation to the latest release:
294-
```
294+
295+
```bash
295296
# Edit `docker-compose.yml` to update the version, if you have one specified
296297
# Pull new images
297298
docker-compose pull
@@ -301,88 +302,66 @@ docker-compose up -d
301302

302303
# SSH Container Passthrough
303304

304-
Since SSH is running inside the container, you'll have to pass SSH from the host to the
305-
container if you wish to use SSH support. If you wish to do this without running the container
306-
SSH on a non-standard port (or move your host port to a non-standard port), you can forward
307-
SSH connections destined for the container with a little extra setup.
305+
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.
308306

309-
This guide assumes that you have created a user on the host called `git` which shares the same
310-
UID/GID as the container values `USER_UID`/`USER_GID`. You should also create the directory
311-
`/var/lib/gitea` on the host, owned by the `git` user and mounted in the container, e.g.
307+
This guide assumes that you have created a user on the host called `git` which shares the same `UID`/ `GID` as the container values `USER_UID`/ `USER_GID`. These values can be set as environment variables in the `docker-compose.yml`:
312308

309+
```bash
310+
environment:
311+
- USER_UID=1000
312+
- USER_GID=1000
313313
```
314-
version: "3"
315314

316-
services:
317-
server:
318-
image: gitea/gitea:{{< version >}}
319-
container_name: gitea
320-
environment:
321-
- USER_UID=1000
322-
- USER_GID=1000
323-
restart: always
324-
networks:
325-
- gitea
326-
volumes:
327-
- /var/lib/gitea:/data
328-
- /etc/timezone:/etc/timezone:ro
329-
- /etc/localtime:/etc/localtime:ro
330-
ports:
331-
- "3000:3000"
332-
- "127.0.0.1:2222:22"
333-
```
315+
Next mount `/home/git/.ssh` of the host into the container. Otherwise the SSH authentication cannot work inside the container.
334316

335-
You can see that we're also exposing the container SSH port to port 2222 on the host, and binding this
336-
to 127.0.0.1 to prevent it being accessible external to the host machine itself.
317+
```bash
318+
volumes:
319+
- /home/git/.ssh/:/data/git/.ssh
320+
```
337321

338-
On the **host**, you should create the file `/app/gitea/gitea` with the following contents and
339-
make it executable (`chmod +x /app/gitea/gitea`):
322+
Now a SSH key pair needs to be created on the host. This key pair will be used to authenticate the `git` user on the host to the container.
340323

324+
```bash
325+
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
341326
```
342-
#!/bin/sh
327+
328+
In the next step a file named `/app/gitea/gitea` (with executable permissions) needs to be created on the host. This file will issue the SSH forwarding from the host to the container. Add the following contents to `/app/gitea/gitea`:
329+
330+
```bash
343331
ssh -p 2222 -o StrictHostKeyChecking=no [email protected] "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
344332
```
345333

346-
Your `git` user needs to have an SSH key generated:
334+
To make the forwarding work, the SSH port of the container (22) needs to be mapped to the host port 2222 in `docker-compose.yml` . Since this port does not need to be exposed to the outside world, it can be mapped to the `localhost` of the host machine:
347335

336+
```bash
337+
ports:
338+
# [...]
339+
- "127.0.0.1:2222:22"
348340
```
349-
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
350-
```
351-
352-
Now, proceed with one of the points given below:
353341

354-
- symlink the container `.ssh/authorized_keys` file to your git user `.ssh/authorized_keys`.
355-
This can be done on the host as the `/var/lib/gitea` directory is mounted inside the container under `/data`:
342+
In addition, `/home/git/.ssh/authorized_keys` on the host needs to be modified. It needs to act in the same way as `authorized_keys` within the Gitea container. Therefore add
356343

357-
```
358-
ln -s /var/lib/gitea/git/.ssh/authorized_keys /home/git/.ssh/authorized_keys
344+
```bash
345+
command="/app/gitea/gitea --config=/data/gitea/conf/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa <YOUR_SSH_PUBKEY>
359346
```
360347

361-
Then echo the `git` user SSH key into the authorized_keys file so the host can talk to the container over SSH:
348+
and replace `<YOUR_SSH_PUBKEY>` with a valid SSH public key of yours.
362349

363-
```
364-
echo "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $(cat /home/git/.ssh/id_rsa.pub)" >> /var/lib/gitea/git/.ssh/authorized_keys
365-
```
350+
In addition the public key of the `git` user on the host needs to be added to `/home/git/.ssh/authorized_keys` so authentication against the container can succeed: `echo "$(cat /home/git/.ssh/id_rsa.pub)" >> /home/git/.ssh/authorized_keys`.
366351

367-
Lastly, Gitea makes `authorized_keys` backups by default. This could be a problem
368-
as the symbolic link made to `authorized_keys` previously could end up pointing
369-
to an old backup. To resolve this, please put the following into your Gitea
370-
config:
352+
Here is a detailed explanation what is happening when a SSH request is made:
371353

372-
```
373-
[ssh]
374-
SSH_AUTHORIZED_KEYS_BACKUP=false
375-
```
354+
1. A SSH request is made against the host using the `git` user, e.g. `git clone git@domain:user/repo.git`.
355+
2. In `/home/git/.ssh/authorized_keys` , the command executes the `/app/gitea/gitea` script.
356+
3. `/app/gitea/gitea` forwards the SSH request to port 2222 which is mapped to the SSH port (22) of the container.
357+
4. Due to the existence of the public key of the `git` user in `/home/git/.ssh/authorized_keys` the authentication host → container succeeds and the SSH request get forwarded to Gitea running in the docker container.
376358

377-
- mount your `.ssh` directory directly into the container i.e. add the
378-
following to the `volumes` section of your Docker container config:
359+
If a new SSH key is added in the Gitea web interface, it will be appended to `.ssh/authorized_keys` in the same way as the already existing key.
379360

380-
```
381-
- /home/git/.ssh/:/data/git/.ssh/
382-
```
361+
**Notes**
383362

384-
Now you should be able to use Git over SSH to your container without disrupting SSH access to the host.
363+
SSH container passthrough will work only if
385364

386-
Please note: SSH container passthrough will work only if using opensshd in container, and will not work if
387-
`AuthorizedKeysCommand` is used in combination with setting `SSH_CREATE_AUTHORIZED_KEYS_FILE=false` to disable
388-
authorized files key generation.
365+
- `opensshd` is used in the container
366+
- if `AuthorizedKeysCommand` is _not used_ in combination with `SSH_CREATE_AUTHORIZED_KEYS_FILE=false` to disable authorized files key generation
367+
- `LOCAL_ROOT_URL` is not changed

integrations/privateactivity_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func testPrivateActivityHelperEnablePrivateActivity(t *testing.T) {
4545
"_csrf": GetCSRF(t, session, "/user/settings"),
4646
"name": privateActivityTestUser,
4747
"email": privateActivityTestUser + "@example.com",
48-
"language": "en-us",
48+
"language": "en-US",
4949
"keep_activity_private": "1",
5050
})
5151
session.MakeRequest(t, req, http.StatusFound)

integrations/user_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestRenameUsername(t *testing.T) {
3030
"_csrf": GetCSRF(t, session, "/user/settings"),
3131
"name": "newUsername",
3232
"email": "[email protected]",
33-
"language": "en-us",
33+
"language": "en-US",
3434
})
3535
session.MakeRequest(t, req, http.StatusFound)
3636

@@ -100,7 +100,7 @@ func TestRenameReservedUsername(t *testing.T) {
100100
"_csrf": GetCSRF(t, session, "/user/settings"),
101101
"name": reservedUsername,
102102
"email": "[email protected]",
103-
"language": "en-us",
103+
"language": "en-US",
104104
})
105105
resp := session.MakeRequest(t, req, http.StatusFound)
106106

integrations/xss_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestXSSUserFullName(t *testing.T) {
2424
"name": user.Name,
2525
"full_name": fullName,
2626
"email": user.Email,
27-
"language": "en-us",
27+
"language": "en-US",
2828
})
2929
session.MakeRequest(t, req, http.StatusFound)
3030

models/action.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ func (a *Action) GetDisplayNameTitle() string {
140140
return a.GetActFullName()
141141
}
142142

143-
// GetActAvatar the action's user's avatar link
144-
func (a *Action) GetActAvatar() string {
145-
a.loadActUser()
146-
return a.ActUser.RelAvatarLink()
147-
}
148-
149143
// GetRepoUserName returns the name of the action repository owner.
150144
func (a *Action) GetRepoUserName() string {
151145
a.loadRepo()

0 commit comments

Comments
 (0)