gitlabaccess-rights

Gitlab, how to configure project readonly to everybody except me


I want to configure access rights in a gitlab project so that everybody can view/clone/download files, but only I can write any file in the project.

In my understanding there is the role Guest, which should be configured to have readonly access. How? Second, somewhere should be configured that all users (except me) has role Guest. How?

I don't get it. In project configuration I can switch "View and edit files in this project", which is clearly not what I want, since I want to distinguish read and write access.


Solution

  • Try following these steps to restrict write access to you:

    1. Settings > General > Visibility, project features, permissions > Project visibility: public
    2. Settings > General > Visibility, project features, permissions > Repository > View and edit files in this project. Non-project members have only read access: Everyone With Access
    3. Settings > Repository > Protected branches > Protect a branch:
      • Branch: select all branches via the * wildcard
      • Allowed to merge: Maintainers
      • Allowed to push: Maintainers

    Step 1 makes your repository discoverable, but no files are shown.
    Step 2 makes your files visible to everyone (no need to login to view files) but a logged user can make edits (being a guest user).
    Step 3 restricts editing to the repository maintainers (just you, by default).