Gitlab default project visibility when creating pr

2020-05-07 19:06发布

问题:

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)?

回答1:

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.