Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,843
Community Members
 
Community Events
168
Community Groups

SourceTree ignoring global .gitignore on Win10

I recently installed SourceTree on a new Win10 laptop and noticed SourceTree wasn't using my global .gitignore file.  I wasted a couple hours trying to get it working.  It looks like a bug under the options page.  The first item at the top of the page is "allow SourceTree to modify your global Git config files" and I verified that this was enabled but I noticed that when I changed the path for the "Global Ignore List" in the SourceTree options that my "c:\users\ssmith\.gitconfig" didn't have the updated excludesfile path.  It was still listed as "~/.gitignore".  After trying a bunch of different ideas, I finally unchecked the "allow SourceTree to modify your global Git config files" option, restarted SourceTree, then checked it again.  And then I set the path for the "Global Ignore List" in the SourceTreeoptions again.  After that, my global .gitignore started working.  Also, I noticed that the excludesfile path in my "c:\users\ssmith\.gitconfig" was now set to "C:\\Users\\ssmith\\.gitignore" instead of "~/.gitignore".  So in summary, it looks like SourceTree might not be correctly reading the "allow SourceTree to modify your global Git config files" option.  So unchecking it and checking it again might signal SourceTree that you really, really want to enable this option.

6 answers

I'm seeing exactly the same problem. SourceTree used to pick up the global .gitignore file but then ceased doing so a few months ago.

I've tried a number of versions of SourceTree and they all fail to pick up the global .gitignore file despite it showing correctly, and opening correctly, in the Tools -> Options -> Git dialogue. I know there are no issues with the file as it works correctly when using git from the command line.

I'm currently using SourceTree 3.3.9 on Windows 10 version 1903.

The only way I have found to overcome it is to copy the global .gitignore into my current repository each time.

Same here...

Sourcetree 3.3.8

Windows 10 (1909 18363.778)

I have the same issue, my global .gitignore is not being read by Sourcetree. 

My git does evaluate it as it should be, but Sourcetree does not.

I tried your workaround, but did not work for me.

I have sourcetree 3.1.3.3158

Win10 Version 1809

I also have the same issue with same sourcetree version 

Still not working.  Version 3.4.7 of SourceTree.  Is Atlassian ever going to fix this?  The problem makes SourceTree useless to me, so my only option is to go to GitHub Desktop or some other provider.  When I right click on an unstaged file, the Ignore option is grayed out.

Can confirm this on Win10 using System Git 2.36.1 (not embedded).

Recently upgraded to 3.4.9.0 - still the same issue.

Switched to Embedded Git 2.36.0 (re-downloaded) - still the same issue.

 

What's my issue?
SourceTree wants to commit changes in path ~/.idea although excluded in global gitignore.

 

I even created a new gitignore_global.txt in the same path as the .gitconfig file.
I switched between CRLF and LF.
I tried different excludesfile values in the form of `~/gitignore_global.txt` or `C:\\path\\to\\gitignore_global.txt` or `C:/path/to/gitignore_global.txt` - all to no avail.

 


 

Update 1:

Note. Just my stupidity.

They were always existing changes, not new changes.

I switched branches discarding all changes. I ran my local scripts again, which resulted in the changes in my .idea directory in the first place. As they were now new and new/updated gitignore always grasps only changes after that, they finally did not show up as changes in Sourcetree.

So it was a basic issue with git and gitignore and had nothing to do with Sourctree itself. 

 


 

Update 2:

Aaaaand it's back.

A deleted file in '.idea' directory comes up as deletion change in Sourctree as well as a lot of files in the 'target' directory, which should also be ignored as per gitignore_global.

Same issue here. A colleague of mine has the exact same issue, while for me it works perfectly, we don't know why.

minnsey Atlassian Team Jun 09, 2019

Can you confirm the global ignore behaviour is working correctly from the command line for both of you?

I can, yes. If I use git on the command line, the gitignore is being evaluated as it should be.  I also noticed that his gitconfig-file is not being written with changes, e.g. if he changes the filename of his global gitignore-file... Don't know if those two issues are being related.

0 votes
minnsey Atlassian Team Mar 19, 2019

Hi

Thanks for raising this we will investigate further, but at this time I can't reproduce it in v3.1.1 (currently being rolled out)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events