在我的多人统一游戏项目(由一个游戏服务器和一个存储库中的客户端项目组成)中,.gitignore文件存在问题。.gitignore文件忽略了大多数文件,但忽略了库工件中的二进制文件。显示在Github桌面上的二进制文件的图像。
我知道.gitignore文件可以工作,因为如果我删除它,就会有30000个更改的文件和8000个没有删除的文件。
# 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/
[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[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
*.aab
*.unitypackage
# 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/*发布于 2021-06-28 01:53:29
呵呵,我想你的答案在.gitignore的第一行
这个.gitignore文件应该放在您的统一项目目录的根目录下
所有这些忽略路径,没有前面的/,只是相对于.gitignore的位置。它的工作方式如下:
将忽略:
./Build/myBinary不会忽视:
./project1/Build/myBinary./project2/Build/myBinary最简单的解决方案是复制您的.gitignore,并将其中的一个放在每个项目目录的根目录下,而不是回购目录。
您的目录应该如下所示:
- project2
- .gitignore
- Assets
- ...如前所述,如果这些目录中的文件已经提交,则需要手动删除它们。
发布于 2021-06-27 05:16:58
当然,假设这个文件夹中只有二进制文件,请尝试删除它们(仅从Git索引中删除,而不是从磁盘中删除),并在应用.gitignore时立即检查(不需要提交)。
cd /path/to/repo
git rm -r --cached path/to/folder/with/binaries/ # note the trailing slash
git check-ignore -v path/to/folder/with/binaries/aBinary # must be a file如果最后一个命令没有返回任何内容,那么就不适用.gitignore规则。
https://stackoverflow.com/questions/68148089
复制相似问题