Add config option to make create-on-push repositories public by default (#12936)
* Add config option to make create-on-push repositories public by default * Fix linting * Add option to 'config cheat sheet' page * Chinese translation Signed-off-by: a1012112796 <1012112796@qq.com> * Fix typo in docs * fix typo * Add option to example config Co-authored-by: Tait Hoyem <code@tait.tech> Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>release/v1.15
parent
82179a6e81
commit
c85c9d40c2
|
@ -30,6 +30,8 @@ ANSI_CHARSET =
|
||||||
FORCE_PRIVATE = false
|
FORCE_PRIVATE = false
|
||||||
; Default privacy setting when creating a new repository, allowed values: last, private, public. Default is last which means the last setting used.
|
; Default privacy setting when creating a new repository, allowed values: last, private, public. Default is last which means the last setting used.
|
||||||
DEFAULT_PRIVATE = last
|
DEFAULT_PRIVATE = last
|
||||||
|
; Default private when using push-to-create
|
||||||
|
DEFAULT_PUSH_CREATE_PRIVATE = true
|
||||||
; Global limit of repositories per user, applied at creation time. -1 means no limit
|
; Global limit of repositories per user, applied at creation time. -1 means no limit
|
||||||
MAX_CREATION_LIMIT = -1
|
MAX_CREATION_LIMIT = -1
|
||||||
; Mirror sync queue length, increase if mirror syncing starts hanging
|
; Mirror sync queue length, increase if mirror syncing starts hanging
|
||||||
|
|
|
@ -51,6 +51,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||||
- `FORCE_PRIVATE`: **false**: Force every new repository to be private.
|
- `FORCE_PRIVATE`: **false**: Force every new repository to be private.
|
||||||
- `DEFAULT_PRIVATE`: **last**: Default private when creating a new repository.
|
- `DEFAULT_PRIVATE`: **last**: Default private when creating a new repository.
|
||||||
\[last, private, public\]
|
\[last, private, public\]
|
||||||
|
- `DEFAULT_PUSH_CREATE_PRIVATE`: **true**: Default private when creating a new repository with push-to-create.
|
||||||
- `MAX_CREATION_LIMIT`: **-1**: Global maximum creation limit of repositories per user,
|
- `MAX_CREATION_LIMIT`: **-1**: Global maximum creation limit of repositories per user,
|
||||||
`-1` means no limit.
|
`-1` means no limit.
|
||||||
- `PULL_REQUEST_QUEUE_LENGTH`: **1000**: Length of pull request patch test queue, make it
|
- `PULL_REQUEST_QUEUE_LENGTH`: **1000**: Length of pull request patch test queue, make it
|
||||||
|
|
|
@ -30,6 +30,7 @@ menu:
|
||||||
- `ANSI_CHARSET`: 默认字符编码。
|
- `ANSI_CHARSET`: 默认字符编码。
|
||||||
- `FORCE_PRIVATE`: 强制所有git工程必须私有。
|
- `FORCE_PRIVATE`: 强制所有git工程必须私有。
|
||||||
- `DEFAULT_PRIVATE`: 默认创建的git工程为私有。 可以是`last`, `private` 或 `public`。默认值是 `last`表示用户最后创建的Repo的选择。
|
- `DEFAULT_PRIVATE`: 默认创建的git工程为私有。 可以是`last`, `private` 或 `public`。默认值是 `last`表示用户最后创建的Repo的选择。
|
||||||
|
- `DEFAULT_PUSH_CREATE_PRIVATE`: **true**: 通过 ``push-to-create`` 方式创建的仓库是否默认为私有仓库.
|
||||||
- `MAX_CREATION_LIMIT`: 全局最大每个用户创建的git工程数目, `-1` 表示没限制。
|
- `MAX_CREATION_LIMIT`: 全局最大每个用户创建的git工程数目, `-1` 表示没限制。
|
||||||
- `PULL_REQUEST_QUEUE_LENGTH`: 小心:合并请求测试队列的长度,尽量放大。
|
- `PULL_REQUEST_QUEUE_LENGTH`: 小心:合并请求测试队列的长度,尽量放大。
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ var (
|
||||||
AnsiCharset string
|
AnsiCharset string
|
||||||
ForcePrivate bool
|
ForcePrivate bool
|
||||||
DefaultPrivate string
|
DefaultPrivate string
|
||||||
|
DefaultPushCreatePrivate bool
|
||||||
MaxCreationLimit int
|
MaxCreationLimit int
|
||||||
MirrorQueueLength int
|
MirrorQueueLength int
|
||||||
PullRequestQueueLength int
|
PullRequestQueueLength int
|
||||||
|
@ -134,6 +135,7 @@ var (
|
||||||
AnsiCharset: "",
|
AnsiCharset: "",
|
||||||
ForcePrivate: false,
|
ForcePrivate: false,
|
||||||
DefaultPrivate: RepoCreatingLastUserVisibility,
|
DefaultPrivate: RepoCreatingLastUserVisibility,
|
||||||
|
DefaultPushCreatePrivate: true,
|
||||||
MaxCreationLimit: -1,
|
MaxCreationLimit: -1,
|
||||||
MirrorQueueLength: 1000,
|
MirrorQueueLength: 1000,
|
||||||
PullRequestQueueLength: 1000,
|
PullRequestQueueLength: 1000,
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/notification"
|
"code.gitea.io/gitea/modules/notification"
|
||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
|
cfg "code.gitea.io/gitea/modules/setting"
|
||||||
pull_service "code.gitea.io/gitea/services/pull"
|
pull_service "code.gitea.io/gitea/services/pull"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ func PushCreateRepo(authUser, owner *models.User, repoName string) (*models.Repo
|
||||||
|
|
||||||
repo, err := CreateRepository(authUser, owner, models.CreateRepoOptions{
|
repo, err := CreateRepository(authUser, owner, models.CreateRepoOptions{
|
||||||
Name: repoName,
|
Name: repoName,
|
||||||
IsPrivate: true,
|
IsPrivate: cfg.Repository.DefaultPushCreatePrivate,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue