Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Source tree corrupts git index file on smb share

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, 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?

1 answer

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:

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

3,202 views 19 18
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you