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

SourceTree Ignores my .gitignore file

Brian July 31, 2013

I have a repository with a .gitignore file at the root of the repository. On the command line, git uses this file and correctly ignores the files I want ignored. SourceTree does not appear to pick up this file. When I go to commit in SourceTree, files that should be ignored are not ignored.

How can I get SourceTree to reconize the .gitignore file

12 answers

4 votes
Eric Cosky January 1, 2016

Maybe this is why:

".gitignore will prevent untracked files from being added (without an add -f) to the set of files tracked by git, however git will continue to track any files that are already being tracked."

 From http://stackoverflow.com/questions/1274057/making-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore

3 votes
Adam LeMmon August 31, 2018

SourceTree uses its own gitignore file. SourceeTree -> Tools -> Options -> Git shows the git ignore file location it uses. You can edit the file from a button in that dialog.

See also: https://stackoverflow.com/questions/30907829/sourcetree-adding-files-in-global-gitignore-not-in-repository-gitignore

Ed Conde October 13, 2019

This worked for me, thanks!

francisco_caldeira February 23, 2021

"Global Ignore List" isn't good practice for those that have multiple projects

2 votes
David_Snelling March 7, 2019

Same issue here. Please fix.

2 votes
Dean February 25, 2019

Same here, cannot ignore.

No doubt SourceTree is an "attempt" to make GIT easier, whether it is successful depends on what day you ask me.

2 votes
NathanThomasWebDeveloper February 3, 2019

Same problem in 2019 that was there in 2013. Are you kidding me???? COME ON!!!!

Amara Hajer March 8, 2019

hhh me too 

1 vote
starikcetin November 29, 2018

git bash status is correct.

sourcetree status is wrong.

1 vote
MitsuhashiDa August 22, 2018

Same here

1 vote
Thomas Berger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2015

Same here

1 vote
Deleted user December 15, 2014

I have the same problem when opening an existing git repository.
The gitignore file itself is ignored by Sourcetree (Version 1.6.11.0)

1 vote
Gabriel - Iulian Dumbrava October 10, 2013

I have the same issue. I have the .gitignore set in advanced settings at the "repository-specific ignore list" option, I have added the *.pyc to .gitignore, yet my pyc files are still listed in the working copy changes.

Thanks!

0 votes
Jason_Armistead June 1, 2020

On a laptop, I have seen issues where SourceTree's behavior seems to depend on whether:

1.  You are working online (where login and authentication use AD, and a login script runs).

OR

2. You're working "offline", i.e. not logging in and authenticating via the corporate Active Directory, and just using cached credentials, or logging on this way and *THEN* connecting via the corporate VPN) 

What appears to happen differently is that the user's "home" location gets changed (at least it did for me). Specifically, the Windows environment variables for HOMEDRIVE and HOMEPATH (which you can see from a CMD prompt by typing SET and scrolling back through what it outputs).

I have seen this manifest as me making a SourceTree settings change e.g. while at home working offline, then when I've gone to the office and suddenly it stopped working, and when I checked the SourceTree settings in the GUI, sure enough, the setting wasn't right. Eventually I figured out that %HOMEDRIVE% and/or %HOMEPATH% were being used when searching for these files.

This took me a while to finally figure out, and it might not be the specific cause of what you're seeing. But it is definitely something to look for and be aware of, especially if you are working in a corporate IT environment using a laptop.

This is also discussed in the SourceTree JIRA ticket

https://jira.atlassian.com/browse/SRCTREEWIN-3788

 

0 votes
Ryan Ault April 21, 2015

Also having the same problem where SourceTree is not recognizing my .gitignore file.

Please Update,

Thank You

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events