I created a very small and naive project template for my students, but when testing it out I found out that this will automatically create a git repository if you have git enabled in the RStudio options. This is overkill, as we're talking about a project template they need for homeworks and their thesis mainly. I know there's other and better ones, but they also require a better understanding of all the dev tools.

I've looked above and beyond, but I can't find any documentation on how to tell RStudio to not do that. Preferably I would add a checkbox like in New Project > New Directory > New Project saying "create a git repository". Anyone knows what I have to add in the .dcf (and possibly other files) to make that happen?

I cloned your repository, devtools::install your package. Then I restarted RStudio, Opened a new project with your template. The new created project has no .git folder, and is not a git repository by default. Git is enabled in RStudio (Tools > Global Options > Git/Svn).

BTW i am on Windows.

It seems I can't reproduce the issue.

I suppose you add a checkbox for git and bind to a function that would to a call to init a git repo or not.

@cderv Thanks for testing that. I checked and if I start from an empty project, I have the same behaviour. The culprit seems to be when I start a new project from a project that has a git repo. In that case the new repo will have a git repo as well, at least on my machine.

I would like to add that checkbox in the dcf file, but I can't find where and how. So I'm back at my original question

You mean if I enter a random project with git in RStudio, then make a new project from there with Files > new project > New directory > Basic Project for Data Analysis ?

I tested that and it works me too. No git repo created.

About the checkbox, you already add for readme and example file. What are you expecting different from a new checkbox called git ?
When this one is true, you may do a system call git init in setup_dap ? maybe not the cleaner but should work with right test for git existence. (I looked in rstudioapi, but did not find any function about VCS)

@cderv That's weird, at my computer it keeps creating git repos. I do start from a .git package repo (the repo of daprojects actually). Hadley just said he believes it is related to another issue that was solved very recently. See also : https://github.com/rstudio/rstudio/issues/2075

What I would like, is just have the same "create a git repository" checkbox as in the default New Project dialog. It should be possible to do without system calls, as a system call would use my other git, is dependent on the setup of the user and might not be compatible over all different OS setups.

Thanks for the bug report. I think RStudio is using the 'saved' value of the Create a git repository checkbox (as used with the most recent project creation) used in the other 'New Project' dialogs. I was able to reproduce the behavior you're seeing with:

Create a New Project using the default 'New Project' template entry, and check the Create a git repository box.

Next, create a New Project using one of the project templates provided by one of the installed packages.

Observe that RStudio automatically initializes a Git repository for the newly created project.

We should make this checkbox visible for other project templates, so that the behavior can be customizable with other projects as well.