Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SourceTree is Ignoring GitIgnore

Michael Guthrie
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 20, 2024

I'm having issues trying to push my Unity project to GitHub because the files that are too large are NOT being ignored. I have a .gitignore file that I added after I realized I had the issue of files being too large. Then afterwards I right clicked all of the relevant unstaged items and chose to "Stop Tracking." After I was happy with this, all of the files that I "stopped tracking" appeared in the "Staged Files" section as "Removed." Okay, that's fine. But then I push, and I get this error:

PushIssue_1.png

The files that I specifically selected to "stop tracking" and match the gitignore file are still being pushed, thus causing my error. What am I doing wrong?

Here is my gitignore file:

# This .gitignore file should be placed at the root of your Unity project directory # # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore # /[Ll]ibrary/ /[Tt]emp/ /[Oo]bj/ /[Bb]uild/ /[Bb]uilds/ /[Ll]ogs/ /[Mm]emoryCaptures/ # Asset meta data should only be ignored when the corresponding asset is also ignored !/[Aa]ssets/**/*.meta # Uncomment this line if you wish to ignore the asset store tools plugin # /[Aa]ssets/AssetStoreTools* # Autogenerated Jetbrains Rider plugin [Aa]ssets/Plugins/Editor/JetBrains* # Visual Studio cache directory .vs/ # Gradle cache directory .gradle/ # Autogenerated VS/MD/Consulo solution and project files ExportedObj/ .consulo/ *.csproj *.unityproj *.sln *.suo *.tmp *.user *.userprefs *.pidb *.booproj *.svd *.pdb *.mdb *.opendb *.VC.db # Unity3D generated meta files *.pidb.meta *.pdb.meta *.mdb.meta # Unity3D generated file on crash reports sysinfo.txt # Builds *.apk *.unitypackage # Crashlytics generated file crashlytics-build.properties

1 answer

0 votes
Brant Schroeder
Community Champion
April 26, 2026

@Michael Guthrie 

You first have to remove the file from tracking and then make Sourcetree to ignore the file.

  1. Change something in the file so that it is shown to you or select it from the "file status" tab at the bottom of the open repository.
  2. Right click on the file and you see "Ignore...", but it is grayed out because as said above its already in track.
  3. Right click on the file and chose "Stop Tracking"
  4. The file will be shown with a red button which indicates it will be removed (from tracking)
  5. A new entry of the same file will be shown in "file status" with a blue question mark indicates a new file (new because you said remove from tracking in 4)
  6. Right click on the file from 5 and now you see the "Ignore..." is able to choose. Click on it and Sourcetree will put a new entry for the file in the .gitignore file
  7. You can see the .gitignore file if you click on "Setting" on the top right, choose "advanced" and then the first entry is about the ignore file, click on "edit" and it will be open.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events