'how to use gitlab's cli to grant permission

I'd want to add a user to many repositories. With restricted access to gitlab after a period of time, I believe it will be simple to handle if we employ certain recursive methods using the cli.

Is there a better solution for my present problem?

in short i have some list of repository in gitlab and i want add 1 user in all of the repositories.



Solution 1:[1]

Theoretically you could use gitlab-rails console although I would recommend using GitLab API members endpoint to add user recursively to multiple projects:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
     --data "user_id=<user_id>&access_level=XX" "https://gitlab.example.com/api/v4/projects/:id/members"

Valid access levels for projects are:

  • No access (0)
  • Minimal access (5) (Introduced in GitLab 13.5.)
  • Guest (10)
  • Reporter (20)
  • Developer (30)
  • Maintainer (40)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lukasz Korbasiewicz