git.ignore不适用于特定的Unity Skybox材质

问题描述 投票:1回答:1

[你好,我是菜鸟,正在使用Github Desktop将更新推送到我和一些朋友正在研究的Unity项目。

我们有一个使用任何天窗材料的噩梦。我们通过昼夜系统的代码动态地更改材料,并且出于某些原因,当其他人尝试执行他无法完成的项目时,我们会对其进行更改。

如果他通过删除材料“解决”问题,那么我们将丢失材料。我尝试将材料添加到git.ignore中12次,并且每当我玩游戏时,材料仍然显示为提交。我做错什么了,如果可以,请告诉我解决方法?

这里是.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

有问题的材料是

Assets/ClassicSkybox/sky08.mat

您可以看到它在文件中列出了3次,Github随时会要求它更改。

git unity3d github gitignore
1个回答
1
投票

忽略被跟踪文件的正常方法是:

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

确保它是.gitignore文件,而不是git.ignore文件。

使用以下命令检查它是否确实被忽略:

git check-ignore -v -- unwantedfile
© www.soinside.com 2019 - 2024. All rights reserved.