Package a local Git Repository in a Toolbox

31 views (last 30 days)
I want to package a local Git repository in my computer as a Matlab Toolbox.
I only want to package the Matlab functions, not the repository files (like the .git folder).
I ignore the git files in the repository folder using the "Package a Toolbox"-GUI.
The Toolbox Files and Folders section of the GUI shows me that I correctly ignored the Git files.
But when I package the Toolbox and install it in Matlab, the Toolbox folder contains the .git folder.
Even though that .git folder is empty, how do I effectively ignore it when packaging the toolbox?
Best regards,
Edit: I am using MATLAB 2015b
  1 Comment
Adanay Martín
Adanay Martín on 5 Sep 2016
I have the same problem. The answer below does not work or I'm missing something here. Did you solve the problem?
Best Regards,

Sign in to comment.

Accepted Answer

Sudhanshu Bhatt
Sudhanshu Bhatt on 9 Nov 2015
Hi Rodrigo,
I understand that you want to remove the .git folder and any files contained inside it, when you package the functions into a toolbox.
I was able to follow the procedure you mentioned and achieve this.
Steps to package a toolbox and remove the .git folder:
Step 1) Navigate to the folder that needs to be packaged as a toolbox.
Step 2) Inside MATLAB, in the Environment section of the Home tab, select Package Toolbox from the Add-Ons menu.
Step 3) Choose the folder where the files to be packaged into a Toolbox are present.
Step 4) In the Package toolbox GUI, there is a section "Toolbox Files and Folders" section, in that section please click on the "Exclude Files and Folders". This will open up a small dialog box.
Step 5) Add "**/.git" to this dialog box. In my case, this looks like:
% All files of a certain name in all subfolders of the toolbox folder:
Please note, that there is no "%" sign in front of "**/.git", otherwise it will be read as a comment. This will remove the .git folder and any files inside it from the packaged toolbox.
Step 6) Package and Install the Toolbox.
Step 7) Once, installed, navigate to the directory where the toolbox is present and it will have all the files you added except the GIT folder.
More information on how to Package a Toolbox can be found in the documentation page below:
Hope this helps.
If this still does not resolve your issue, you can create a Technical Support Request by clicking on the link below:
Sudhanshu Bhatt

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!