1

I'm not sure what's causing the failure here as I have /Library in my gitignore. I also have LFS enabled since the creation of the project and have made multiple pushes without error. I've followed the instructions here for the "hook declined" message but still no luck. Even on new branches. Any ideas?

enter image description here

.gitignore:

# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Recordings can get excessive in size
/[Rr]ecordings/

# 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
*.aab
*.unitypackage
*.app

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
Temp/UnityLockfile
James
  • 29
  • 8
  • `git push` pushes what is in the commit(s) you push. They contain the files that they contain: once the commits are made, they cannot be changed. If you don't like the set of files that's in the existing commits—e.g., because you committed a file too soon, before listing it in `.gitignore`—you'll need to stop using those commits and make some new-and-improved commits instead. People call this "rewriting history" since one sets up the branch names to refer to the new and improved commits instead of the (still existing) bad commits. – torek Nov 22 '22 at 04:29

1 Answers1

1

First, make sure the Library/ArtifactDB is actually ignored:

cd /path/to/repository
git check-ignore -v -- Library/ArtifactDB

If empty, try and remove Library content if it was already tracked:

git rm --cached -r Library/
git commit -m "Remove Library"
git check-ignore -v -- Library/ArtifactDB

I also suggests in the comment a git lfs untrack as seen here.

And derHugo adds:

You could try to do an additional git clean -xfd which will remove anything that is not supposed to be included and then see if that file still exists and try again.
Add -n if you are not sure which will do a dry-run just printing out what would be deleted.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for this! Unfortunately it didn't work. It showed Library wasn't included, and I removed it from the cache. Got `.gitignore:5:/[Ll]ibrary/ Library/ArtifactDB ` when I re-commited and checked again. Pushed to dev branch, same exact error messages as before. – James Nov 16 '22 at 07:04
  • 1
    @James So maybe you need to [`lfs untrack` that file first](https://stackoverflow.com/a/54119191/6309), in addition of the `git rm --cached -r`. – VonC Nov 16 '22 at 07:10
  • Getting closer. Created new branch. Checked gitignore. `git lfs untrack "Library/"` , then renormalize. Checked LFS status- no Library contents so that's good. Commit and push: same errors. And there were no library files in the commit. So I'm very confused why the only folder staged is "Assets" yet the same Library/ArtifactDB is appearing – James Nov 16 '22 at 07:52
  • You could try to do an additional `git clean -xfd` which will remove anything that is not supposed to be included and then see if that file still exists and try again ^^ Add `-n` if you are not sure which will do a dry-run just printing out what would be deleted – derHugo Nov 16 '22 at 08:56