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

SourceTree ignoring global .gitignore on Win10

mccunet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 11, 2019

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.

7 answers

1 vote
Mike
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 2, 2020

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.

1 vote
DigiLive
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2020

Same here...

Sourcetree 3.3.8

Windows 10 (1909 18363.778)

1 vote
kanobuho
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2019

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

Mohsin Kokab
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 5, 2019

I also have the same issue with same sourcetree version 

0 votes
Ryan Canfield
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2022

Sigh, still seeing this in 3.4.10.

The global .gitignore is completely ignored (heh) by sourcetree regardless of any sourcetree settings. Checking git status in bash works as expected.

Repo .gitignore does work however, so this can be used as a workaround. This is not the only sourcetree bug that causes global settings to be ignored while git bash works perfectly. Very disappointing.

0 votes
Michael Vircsik January 5, 2022

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.

Carsten A_ June 30, 2022

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.

0 votes
Vortilion June 6, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
June 9, 2019

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

Vortilion June 11, 2019

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
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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
AUG Leaders

Atlassian Community Events