GitLab: how add users in bulk

For this task we will use the GitLab API.

1. Obtain the PRIVATE-TOKEN

Do you need a token to prove to be authenticated

giovanni@vm-gittest:~/git$ curl "" --data 'login=root&password=ThePassword'  | python -mjson.tool
    "avatar_url": "",
    "bio": null,
    "can_create_group": true,
    "can_create_project": true,
    "color_scheme_id": 1,
    "created_at": "2015-03-23T17:41:18.649Z",
    "email": "",
    "id": 1,
    "identities": [],
    "is_admin": true,
    "linkedin": "",
    "name": "Administrator",
    "private_token": "2xyxyxysyxsyxsUe8",
    "projects_limit": 10000,
    "skype": "",
    "state": "active",
    "theme_id": 2,
    "twitter": "",
    "username": "root",
    "website_url": ""

2. Create the users

You can add a new user on GitLab using the command:

curl --header "PRIVATE-TOKEN: YourPrivateToken" -d "$name=name" ""

To add users in bulk we need a file containing all the users to be created like:

mark = mark <>
zella = zella <>
uie = uie <>
kers = kers <>

and run the command:

for i in `cat authors-transform.txt | awk {'print "email="$1""$1"&name="$1""'}`; 
   do  curl --header "PRIVATE-TOKEN: YourPrivateToken" -d $i ""; 

WARNING: at this point all the users will receive a confirmation email to activate their account.