Im using repos that are hosted on a windows server to ease deployment of code for testing with end users.
Previously the repos were hg, and I used source tree to view and update them. Sourcetree was able to access the repos by mounting them as a local disk. This was slow but worked fine for a year.
Recently we migrated to github and the repos on the server are now git. After a short period of time, perhaps 20 minutes, after cloning the index file in the repo will become corrupt. I can delete the file and reset the repo, but it will become corrupt again shortly.
I have removed the shared repos from source tree and Ive been using command line git to operate on the repos (using the same mounted network drive) without problems.
Sourcetree's version of git is that same as my system version, 220.127.116.11. Im guessing that something unhappy is going on with 'refresh automatically on file change'. I have disabled it and so far the corruption hasn't happened again. Perhaps you could make the auto refresh configurable per repo?
What happens with the auto-refresh is that the kernel file events notify SourceTree of a file change, and it calls 'git status'. SourceTree does not modify anything other than via git itself, and git status et al are read-only commands anyway in theory.
It's possible that parallel calls to 'git status' cause corruption on an SMB share, perhaps because the locking git usually uses doesn't work via that method - you wouldn't see this on the command line because every command operates strictly in serial unless you have more than one console open at a time. SourceTree allows parallel calls to populate different views because it's faster, and has never caused any issues previously.
The auto-refresh already is configurable per repository, see the 'Settings' option in the repo window and the 'Automaticall refresh' option in the Misc settings at the bottom. However I don't think it's this - it may just be that having the auto-refresh enabled just triggers it faster. I bet the underlying cause is that SMB shares are just not safe to use with git - there are other reports of SMB corruptions such as this: http://stackoverflow.com/questions/2446755/share-pre-initialized-git-repository
My advice would be not to do this. You'd be far better to keep your repositories on your local drive and push to an SMB remote if you need to.
Six years later, and this exact problem just hit me. Incredible.
In my case, I've got a VM with my development environment. The source code is checked out from GitHub and then mounted via Samba from an Ubuntu guest to Mac host.
A few minutes of poking around the repo with Source Tree and the index.lock file gets corrupted and I have to remove it and reset the repo.
Seems to be a Source Tree-specific issue. I can cd to the mounted directory in the host and use git commands without problem.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs