Skip to content

Commit 3336bfb

Browse files
lunnydelvh
andcommitted
Merge push to create, open PR from push, and push options docs articles into one (go-gitea#23744)
Add documentation for this feature. <img width="734" alt="gitea-push-hint" src="https://user-images.githubusercontent.com/81045/227921177-af08ab76-7556-4a69-8da9-bb59cec1388b.png"> --------- Co-authored-by: delvh <dev.lh@web.de>
1 parent 001d3fb commit 3336bfb

File tree

5 files changed

+140
-66
lines changed

5 files changed

+140
-66
lines changed

docs/content/doc/usage/push-options.en-us.md

-33
This file was deleted.

docs/content/doc/usage/push-options.zh-tw.md

-33
This file was deleted.

docs/content/doc/usage/push.en-us.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
date: "2020-07-06T16:00:00+02:00"
3+
title: "Usage: Push"
4+
slug: "push"
5+
weight: 15
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "usage"
11+
name: "Push"
12+
weight: 15
13+
identifier: "push"
14+
---
15+
16+
**Table of Contents**
17+
18+
{{< toc >}}
19+
20+
There are some additional features when pushing commits to Gitea server.
21+
22+
# Open PR through Push
23+
24+
When you push commits to a non-default branch for the first time,
25+
you will receive a link you can click on to visit the compare page of your branch compared to your main branch.
26+
From there, it's easy to create a pull request, even if you want to target another branch.
27+
28+
![Gitea Push Hint](/gitea-push-hint.png)
29+
30+
# Push Options
31+
32+
In Gitea `1.13`, support for some [push options](https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt)
33+
were added.
34+
35+
## Supported Options
36+
37+
- `repo.private` (true|false) - Change the repository's visibility.
38+
39+
This is particularly useful when combined with push-to-create.
40+
41+
- `repo.template` (true|false) - Change whether the repository is a template.
42+
43+
Example of changing a repository's visibility to public:
44+
45+
```shell
46+
git push -o repo.private=false -u origin main
47+
```
48+
49+
# Push To Create
50+
51+
Push to create is a feature that allows you to push to a repository that does not exist yet in Gitea. This is useful for automation and for allowing users to create repositories without having to go through the web interface. This feature is disabled by default.
52+
53+
## Enabling Push To Create
54+
55+
In the `app.ini` file, set `ENABLE_PUSH_CREATE_USER` to `true` and `ENABLE_PUSH_CREATE_ORG` to `true` if you want to allow users to create repositories in their own user account and in organizations they are a member of respectively. Restart Gitea for the changes to take effect. You can read more about these two options in the [Configuration Cheat Sheet]({{< relref "doc/administration/config-cheat-sheet.en-us.md#repository-repository" >}}).
56+
57+
## Using Push To Create
58+
59+
Assuming you have a git repository in the current directory, you can push to a repository that does not exist yet in Gitea by running the following command:
60+
61+
```shell
62+
# Add the remote you want to push to
63+
git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
64+
65+
# push to the remote
66+
git push -u origin main
67+
```
68+
69+
This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.
70+
71+
Push-to-create will default to the visibility defined by `DEFAULT_PUSH_CREATE_PRIVATE` in `app.ini`.

docs/content/doc/usage/push.zh-tw.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
date: "2020-07-06T16:00:00+02:00"
3+
title: "使用: Push"
4+
slug: "push"
5+
weight: 15
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "usage"
11+
name: "Push"
12+
weight: 15
13+
identifier: "push"
14+
---
15+
16+
**Table of Contents**
17+
18+
{{< toc >}}
19+
20+
There are some additional features when pushing commits to Gitea server.
21+
22+
# Push Merge Hint
23+
24+
When you pushing commits to a non-default branch, you will get an information from
25+
Gitea which is a link, you can click the link and go to a compare page. It's a quick
26+
way to create a pull request or a code review yourself in the Gitea UI.
27+
28+
![Gitea Push Hint](/gitea-push-hint.png)
29+
30+
# Push Options
31+
32+
Gitea 從 `1.13` 版開始支援某些 [push options](https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt)
33+
34+
35+
## 支援的 Options
36+
37+
- `repo.private` (true|false) - 修改儲存庫的可見性。
38+
39+
與 push-to-create 一起使用時特別有用。
40+
41+
- `repo.template` (true|false) - 修改儲存庫是否為範本儲存庫。
42+
43+
以下範例修改儲存庫的可見性為公開:
44+
45+
```shell
46+
git push -o repo.private=false -u origin main
47+
```
48+
49+
# Push To Create
50+
51+
Push to create is a feature that allows you to push to a repository that does not exist yet in Gitea. This is useful for automation and for allowing users to create repositories without having to go through the web interface. This feature is disabled by default.
52+
53+
## Enabling Push To Create
54+
55+
In the `app.ini` file, set `ENABLE_PUSH_CREATE_USER` to `true` and `ENABLE_PUSH_CREATE_ORG` to `true` if you want to allow users to create repositories in their own user account and in organizations they are a member of respectively. Restart Gitea for the changes to take effect. You can read more about these two options in the [Configuration Cheat Sheet]({{< relref "doc/administration/config-cheat-sheet.zh-tw.md#repository-repository" >}}).
56+
57+
## Using Push To Create
58+
59+
Assuming you have a git repository in the current directory, you can push to a repository that does not exist yet in Gitea by running the following command:
60+
61+
```shell
62+
# Add the remote you want to push to
63+
git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
64+
65+
# push to the remote
66+
git push -u origin main
67+
```
68+
69+
This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.

docs/static/gitea-push-hint.png

412 KB
Loading

0 commit comments

Comments
 (0)