如何从终端或命令行创建 gitlab 项目
问题描述:
我有内部设置 gitlab 服务器.我想运行单独的 ant 脚本并在该 gitlab 服务器中创建一个项目.(无需在 gitlab UI 中创建新项目)
I have internal setup gitlab server. I want to run separate ant script and create a project in that gitlab server. (without creating new project in gitlab UI)
在 ant 中,我可以使用 exec 可执行文件并运行 bash 命令.
In the ant i can use exec executable and run the bash commands.
以及如何将Visibility Level等参数发送到gitlab服务器来创建项目?
And also how to send the Visibility Level and other parameters to gitlab server to create the project?
答
您需要使用 GitLab API 来创建项目
You Would need to use the GitLab API to create a project
POST /projects
可选参数之一是:
visibility_level
(可选):
- 0 是私有的(必须为每个用户明确授予项目访问权限)
curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-X POST \
--data-urlencode 'name=myproject' \
--data-urlencode 'visibility_level=0' \
"http://example.com/api/v3/projects"