1

Hello I'm a noob and using Github Desktop to push updates to a Unity project me and some friends are working on.

We have had a NIGHTMARE with ANY skybox material used. We change the material dynamically through code for a day night system and for some reason when someone else tries to pull the project he can't.

If he "resolves"the problem by deleting the material then we lose the material. I have tried adding the material to git.ignore 12 times and whenever I play the game the material still shows up for a commit. Am I doing something wrong and if so could you please tell me the solution?

Here's the .gitignore:

# 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*
Assets/ClassicSkybox/sky08.mat

# 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
*.meta
!*.prefab.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties


Assets/ClassicSkybox/sky08.mat
Assets/ClassicSkybox/sky08.mat

The problematic material is the

Assets/ClassicSkybox/sky08.mat

As you can see it's listed 3 times in the file and Github still asks for it any time it changes.

Qushy
  • 31
  • 4
  • 1
    You have not shown us what your gitignore looks like or what the file's name. Please provide more details and we can help. What is the error that git produces? Please edit your post to include these. – Derek C. Mar 25 '20 at 00:37
  • Does this answer your question? [Remove file from the repository but keep it locally](https://stackoverflow.com/questions/3469741/remove-file-from-the-repository-but-keep-it-locally) – Leo Bartkus Mar 25 '20 at 03:59
  • I added the .gitignore to the original post. Hope that helps. :D Also I want the file to be in the repo I just don't want Github to ask me to apply any changes to it. I can't really show the error cause that will mess up my project, sorry. – Qushy Mar 25 '20 at 14:59
  • What does `git check-ignore -v -- Assets/ClassicSkybox/sky08.mat` returns (when done from the folder where a `ls Assets/ClassicSkybox/sky08.mat` would work) – VonC Mar 26 '20 at 05:08

1 Answers1

1

The normal way to ignore a file that was tracked is:

git rm --cached unwantedfile
echo unwantedfile>.gitignore
git add .gitignore
git commit -m "Ignore unwantedfile"

Make sure it is a .gitignore, not a git.ignore file.

Check that it is indeed ignored with:

git check-ignore -v -- unwantedfile
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250