从终端创建项目时 Gitlab 默认项目可见性 [英] Gitlab default project visibility when creating projects from terminal

查看:23
本文介绍了从终端创建项目时 Gitlab 默认项目可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我开始一个新项目时,我都会将它添加到我的 Gitlab VCS(本地):

git 初始化混帐添加.git commit -m "提交信息"git 远程添加源 git@git.example.com:foo.gitgit push --set-upstream 原始主机

这会导致:

<上一页>枚举对象:7,完成.计数对象:100% (7/7),完成.使用多达 4 个线程的 Delta 压缩压缩对象:100% (7/7),完成.写入对象:100% (7/7),5.65 KiB |2.82 MiB/s,完成.总计 7 个(增量 0),重复使用 0 个(增量 0)偏僻的:remote: private 项目 foo 已成功创建.偏僻的:远程:要配置远程,运行:...等等等等等等

但是,这会创建一个私有项目.我可以在 Web GUI 中创建项目;这尊重了我希望新项目默认为 internal 的设置(管理 > 设置 > 常规 > 可见性和访问控制 > 默认项目可见性).

我在想;是否可以从终端创建上述项目并指定可见性(私有、内部或公共中的任何一个)?

解决方案

官方文档说是no.默认情况下,从命令行创建的项目始终设置为私有.

https://docs.gitlab.com/ee/gitlab-basics/create-project.html#push-to-create-a-new-project

<块引用>

如果您有权访问关联的命名空间,GitLab 将自动在该 GitLab 命名空间下创建一个新项目,默认情况下其可见性设置为 Private(您可以稍后在 项目设置)

您可以从 UI 或使用 Gitlab API 更改项目级别.

Whenever I start a new project I add it to my Gitlab VCS (on-premise):

git init
git add .
git commit -m "Commit message"
git remote add origin git@git.example.com:foo.git
git push --set-upstream origin master

This results in:

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 5.65 KiB | 2.82 MiB/s, done.
Total 7 (delta 0), reused 0 (delta 0)
remote:
remote: The private project foo was successfully created.
remote:
remote: To configure the remote, run:
...blah blah blah

However, this creates a private project. I can create projects in the web GUI; this respects the setting that I want new projects to default to internal (Admin > Settings > General > Visibility and access controls > Default project visibility).

I was wondering; is it possible to create a project as above, from the terminal, and specify the visibility (any one of private, internal or public)?

解决方案

Official docs say's no. Project's created from command line always set to Private by default.

https://docs.gitlab.com/ee/gitlab-basics/create-project.html#push-to-create-a-new-project

If you have access rights to the associated namespace, GitLab will automatically create a new project under that GitLab namespace with its visibility set to Private by default (you can later change it in the project’s settings)

You can change project level from UI or using Gitlab API.

这篇关于从终端创建项目时 Gitlab 默认项目可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆