Change the default for "Initialize repository with a README"

When I try to create a new blank project, the checkbox for “Initialize repository with a README” is always checked. Is it possible change the default behaviour of this checkbox to be unchecked?

Best Regards

I contacted support and they were swift to give me this answer:

(answer shortened for brevity)

You could simply edit the HTML template and set the checkbox to unchecked there. I’ll have to mention that doing that counts as a modification of GitLab source, which technically will make your instance become unsupported. But that just means that in other Support tickets you’d be asked to revert back to the original version, and for such a microscopic change it really shouldn’t cause any issues. To do so, you’d need to edit the file /opt/gitlab/embedded/service/gitlab-rails/app/views/projects/_new_project_fields.html.haml on your GitLab server and replace true with false in line 66. There’s no need to restart GitLab afterwards.

I hope this helps anyone comming across this post in the future.

Would be nice for Gitlab to integrate this properly by a config entry in the gitlab.rb file. The problem I see with editing this file manually is that when you update Gitlab, I can envisage one of two scenarios:

  1. The edited file will be replaced with a new one, and will need to be edited again to disable that option.
  2. The edited file will not be replaced when gitlab-ce or gitlab-ee is upgraded, which potentially means any new project fields added in newer versions of Gitlab will not appear in your interface, or potentially cause other errors.
1 Like

Yes. These are both valid concerns.

I would also like for GitLab to make this an option per server instance or group.

I opened an issue for it:

you can vote on it to attract interest which could help ensure it gets integrated quicker.

I am new to the whole ecosystem, so I have get used to where everything is and where feature requests should be posted. Thank you for opening an issue for this. I have voted on it.

I would go as far as questioning whether the default “checked” state is what most users want… I think we could have a small script check all repos created after the feature was introduce and see whether people tend to use it or not. Created a ticket for this as well: Make "Initialize repository with a README" unchecked by default (#383749) · Issues · / GitLab · GitLab

I personally use it, and want my repositories created with a That said I do understand that others do not want to. The issue was opened in the sense to allow choice, so that both types of people will be happy. I believe it’s unfair to take the option away and then force people like me to select it. Therefore, there needs to be an option that allows you to configure it how you want to make everyone happy.