Out-Of-Tree Builds with Git

Jul 4, 2011 at 11:32 AM


I just downloaded and installed the Git Source Control Provider and was wondering if it is possible to connect it with an existing out-of-tree build of my git repository.

I have a project where I use GIT for my source control and CMake to generate the VS solution file in a different folder than the repository (in order to keep solution files out of the repository). Is it possible to select the git repository folder somewhere? The source files are located in the repository folder so it should be possible to extract the correct repository folder, right?

Best Regards,


Jul 28, 2011 at 6:47 PM

It should recognize the repository in your source folder. If not please show me your folder structure. I will see what I can do.


Aug 1, 2011 at 1:57 PM


I have a structure with 2 different folders like the following:




I have the source code in the 'repository' folder and the solution files (and the corresponding binaries) in the 'build' folder. CMake allows to generate the solution file in a different folder than the one with the source code (out-of-tree build) which is a great way of seperating the files I want to commit to the repository and the machine / OS specific files from my IDE. Of course you can as well use the .gitignore files to exclude the project specific files from the unstaged files list, but it seems a lot more clear to have it just in a seperate folder. Especially since Visual Studio knows how to handle it when the source files are located in a different folder than the solution files. When I use the Git Source Control Provider and right click on one of the source files in VS(2010), it does not recognize the source files as being part of a repository (probably because the solution folder differs from the git repository folder).

Best Regards and Thanks for your help!


Aug 6, 2011 at 2:41 AM

Hi Jan,

I thought it worked already with the folder structure you have. Apparently you found a bug. I will fix it in future release.

Here is a workaround that you can try. You can create an empty git repository under workspace folder. Just git init, no need to commit anything.


You will see a yellow plus sign on solution node, just ignore it since you probably don't care the solution file. Now you will see the file status of your projects in repository folder.

Let me know if this works for you.



Aug 7, 2011 at 3:14 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 8, 2011 at 10:42 AM
Edited Aug 8, 2011 at 10:45 AM

Hi yysun,

thanks for your help. The workaround didn't work for me or maybe I did something wrong. I forgot to mention that the workspace/repository folder is the one that is under version control by git. The workspace/build folder is not. If I create a .git folder in workspace/.git and initialize it, I can see the yellow plus sign on the solution and on the source files as well. For the source code files, the Git Source Control Provider points to the empty .git repository (that doesn't have a destination). For some reason it can't figure out that the file is located in another folder that is under version control (which is the one that I need to commit to). My current folder structure looks like this:

workspace/.git (which lets the workspace/ folder point to an empty master)

workspace/repository (the folder where my source files are located and which is under git version control)

workspace/build (where all the solution specific files are located, not under version control)

Regards and thanks for your help,


EDIT: Moved the discussion to the work item: http://gitscc.codeplex.com/workitem/16350