SourceTree very slow with many repositories
GitPerformanceRepositoryAtlassian SourcetreeGit Problem Overview
I work on a lot of small projects on daily basis and need to switch often.
- I have over 50 Git Repositories in Sourcetree.
- Usually 5 projects are open in "Tabs".
Switching from "Tab" in SourceTree is very slow. Sometimes up to 15 seconds. How can I improve this behaviour?
Git Solutions
Solution 1 - Git
I know this is an old question, but you could also try this:
https://stackoverflow.com/a/24045966/371917
$ git config --global core.preloadindex true
$ git config --global core.fscache true
$ git config --global gc.auto 256
Secondly, here is a post that explains that git gc --aggressive
may not be a great idea.
Solution 2 - Git
Executing the stated git command did not do the trick for me. Eventually what really speed up SourceTree was disabling 'spell check commit messages' in the tools > options menu. I also disabled 'load avatar images from gravatar.com' option while I was at it.
Solution 3 - Git
Any action in my source tree was super slow. Commit, click on a file to see changes, push etc.
I discovered that my antivirus (avast) was the cause. I disabled the file protection and source tree became immediate.
Solution 4 - Git
I had this problem too. I also have avast and this worked for me and might work for you and maybe a different AV. But I added the C:\Users\YOURNAME\AppData\Local\Atlassian
to my avast exclusions directory and now it is running much faster!
Solution 5 - Git
For me it was the 'spell check commit messages' option in the settings. Even clicking the tick took 20 sec to process, but it was the last freezing I experienced.
Solution 6 - Git
The source tree ticket system has a ticket about a similar bug that was fixed. http://www.lifehacker.com.au/2015/01/6-month-old-critical-performance-bug-with-sourcetree-is-getting-attention/
I never used so many repos at once and assume that sourcetree is not build to handle this amount of data on every time you switch tabs. I assume sourcetree need to refresh the data and reads and build your data out of the disk page file.
Try to use fewer projects and see it you still have the same problem.
If you still experience lack of performance try to run gc (garbage collector) on your repos and test it again.
git gc --aggressive
shrinks the repository size.
Solution 7 - Git
Improved performance with
- Install latest git exe from https://git-scm.com/download/win
- Configured Options > Git >
Use System Git
insteadUse Embedded Git
Solution 8 - Git
This may help someone else. I was having slow response issues with SourceTree 1.6.x and git 1.9.x. Downgrading git to 1.8.3 and SourceTree to 1.5.2 solved the problem.
Solution 9 - Git
-
Move the git folder to an SSD drive, if possible (dramatically improved my SourceTree performance).
-
Avoid having a lot of stashes, which REALLY slows down SourceTree.
Solution 10 - Git
Latest version currently 2.1.2.5 released June 2017 was running dog slow for me even after trying all the answers here prior to today (even with just 1 project).
Apparently, .gitconfig was written to a network drive (H:) when SourceTree was first installed. This is what got the performance to instantaneous for me:
-
Move .gitconfig to local SSD (C:)
-
Set HOME variable. In Environment Variables (specifically User variable), set HOME to the value of C: (or whatever other path you decide to set).
Solution 11 - Git
TL;DR:
Option 1: (Keep using SourceTree): SourceTree does long thorough refresh. Can be turned off by setting filter to "Modified". (For me I had to set it back and forth once to take effect).
Option 2: (Use Tower/CLI and set showUntrackedFiles)
Option 3: (Use Tower/CLI and With Scalar).
Microsoft has a solution for improving repo performance: Scalar
Long Version: Had this issue with large repository (has many files). Investigated and found root cause of SourceTree slowness.
You can test issue in command line:
git status -uall
vs
git status -uno
If you find git status -uall
is super slow (same slowness as SourceTree then this is likely your culprit).
Sourcetree always uses -uall
when doing status refreshes.
There is a way to configure your git config file to always skip searching for untracked files when running git status
via:
git config --local status.showUntrackedFiles no
The problem then becomes SourceTree refuses to respect this flag (while other tools like Tower do respect it).
More info can be found here (under status.showUntrackedFiles
section):
https://git-scm.com/docs/git-config
And here (under --untracked-files[=<mode>]
section):
https://git-scm.com/docs/git-status
NOTE: Setting showUntrackedFiles
property to no
on your repo's git config file will mean when you add a new file it won't be picked up by git status
unless you explicitly run it with -uall
param.
Solution 12 - Git
For me the issue was that I had way to many untracked files. Modified my .gitignore and SourceTree stoped being slow