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
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."
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.
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).
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
Free training for Jira, Confluence, and Jira Service Management Start faster and be more productive with Atlassian cloud products. Take the guess work out of where to begin, and gain confidence wi...
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