有没有办法将用户添加到自动gitlab? [英] Is there a way to add users automatically into gitlab?

查看:170
本文介绍了有没有办法将用户添加到自动gitlab?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有了服务器中运行的gitlab。现在,我也得到了只是一个要加入到gitlab需要用户和邮件列表。有没有办法来自动做到这一点? (即由脚本/服务)

I've got a gitlab running on server. For now, I've also got just a list of users and emails needed to be add into gitlab. Is there a way to do this automatically? (i.e. by script/service)

推荐答案

您可以使用的 GitLab API来创建用户在脚本中。 卷曲的最新版本,可将URL恩给你code POST数据。否则,将空间必须是 20% - 数据而不是 - 数据 - urlen code

You can use the GitLab API to create users in a script. Recent versions of curl can url-encode POST data for you. Otherwise spaces will have to be %20 and --data instead of --data-urlencode.

curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" --data-urlencode "email=jon@doe.com&password=defaultpassword&username=jdoe&name=Jon Doe" "http://example.com/api/v3/users"

卷曲是阻力最小的与你的preferred shell语言的路径(在我的案件的Bash)。如果你不想使用curl脚本创建你的用户有不同的语言与GitLab API交互大量的库。任你选。热门库包括:

Curl is the path of least resistance with your preferred shell language (in my case Bash). If you don't want to use curl to script creating your users there are numerous libraries for different languages to interact with the GitLab API. Take your pick. Popular libraries include:

  • Java - java-gitlab-api
  • PHP - php-gitlab-api
  • Python - pyapi-gitlab, python-gitlab, or python-gitlab3
  • Ruby - Gitlab wrapper

我敢肯定还有更多的API库用于其他语言的只是谷歌为你的preferred语言,包括的 GitLab API 的作为查询的一部分。

I'm sure there are many more API libs for other languages just google for your preferred language and include GitLab API as part of the query.

这篇关于有没有办法将用户添加到自动gitlab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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