Restrict private project forks, either completely or to private forks only
Description
Hey, I am working on a project for which it would be fine to provide public access to the source code, however it would not be fine for people to create and publish derivative works based on that project.
To accomplish that I would like to create a public project, but limit forking of the project to private (personal) forks only. This would allow people to create forks and making changes for personal use or for preparing pull requests, but would prevent people to easily/accidentially (with the click of one button next to the project) create and publish derivative works in the form of public forks.
Currently the project visibility is restricted by the visibility of the parent repository. I am basically asking for a per-project setting which allows specifying the allowed fork visibility level. So even public projects could restrict forking to 'private forks only', or even 'no forks' (similar as seen on bitbucket).
A workaround for my situation would currently be to make the project private, and use gitlab's API and a web form to automatically let any interested person join the project's group.
Proposal
A per-project setting for private projects which allows specifying the allowed forking behavior: allow forks or only allow private forks.
We should allow this to be changed in project settings for existing projects.
- When changing this in project settings, we should make sure the user is informed of the effect on any existing forks (existing forks will not be affected) if any exist.
- When moving to a more restrictive setting (the project previously allowed forks, and now the upstream repo selects "no forks"), we should leave any existing forks.
Design solution
For private projects, add a new element under Repository
in Project Settings -> General -> Permissions:
- Title: 'Forks'
- Description: 'Allow users to make copies of your repository to a new project'
- Dropdown options:
- 'Allow public forks'
- 'Only allow private forks'
Switching the toggle off will disallow all forks. Switching the toggle on will give users the option between allowing all forks, or only private ones.
There will be a question
icon that will show a popover on hover:
Allowing only private forks will force the visibility of new forks to Private. Existing forks will not be affected.
Links / references
Bitbucket offers this when creating a new project: