1

Using the command line or a third-party git manager, I can execute basic git commands like commit, reset and stash with MATLAB open, presumably because I'm working solely on my local branch. As soon as I want to use git checkout somebranch I get the error:

fatal: cannot create directory at [dir]: Permission denied

What's worse is that my current working directory (on the old branch) now has unstaged changes from the branch I wanted to checkout. Other programs simply reload the files from the newly checked out branch. I've tried finding a way to change how MATLAB locks files but to no avail.

MATLAB R2017b
Windows 10 Pro

More Info

The file structure in my git directory is different between the two branches. I think the issue arises from the fact that a deleted sub-directory was in MATLAB's "set path" list.

Alex
  • 75
  • 9
  • 2
    Are you calling git from a separate software,or [from MATLAB itself](https://stackoverflow.com/questions/42271061/matlab-git-by-command-window)? – Ander Biguri Oct 19 '17 at 15:00
  • Interesting. There is a difference if the files that staged while commiting are open in the editor or not? – Adiel Oct 19 '17 at 17:53
  • @AnderBiguri I'm trying to call git from a separate software (GitHub/Sourcetree) or from Git Shell. I can use MATLAB's built-in git manager without an issue but I would rather not. I saw the link about using git commands in the command window, but I need to change some system variable first... maybe it's the best option. – Alex Oct 19 '17 at 18:32
  • @Adiel The issue persists after closing all the files in my editor. – Alex Oct 19 '17 at 18:35
  • Note that the file structure in my git directory is different between the two branches. – Alex Oct 19 '17 at 18:46

1 Answers1

1

First, I would recommend

Second, double-check any locking issue with Process Explorer.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for this. It seems to be working, but I had previously merged the branch I was having issues with (the one with a different file structure), so I can't test directly. I think the issue was due to MATLAB having a folder in its "set path" list that was changed between the two branches. I assume a separate working tree would fix this (although I would need to setup new paths for MATLAB). I've accepted your answer. – Alex Oct 20 '17 at 12:30