Jetbrains Rider 的 .idea 文件夹的 .gitignore 设置不起作用

kug*_*ang 5 git gitignore unity-game-engine github-desktop rider

我目前正在使用 Windows10 上的 Unity 和 Rider 为 Android 开发一个游戏项目。Git 管理正在使用 Github Desktop。

完成游戏制作后,尝试设置.gitignore上传到Github,连接gitignore.io,选择windows,unity,jetbrains+all,然后在我的.gitignore中输入.gitignore,显示在屏幕上。代码链接是https://www.gitignore.io/api/unity,windows,jetbrains+all

下面的代码是我写的 .gitignore 代码。

# Created by https://www.gitignore.io/api/unity,windows,jetbrains+all
# Edit at https://www.gitignore.io/?templates=unity,windows,jetbrains+all

### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### JetBrains+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

### Unity ###
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*

# Visual Studio cache directory
.vs/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/unity,windows,jetbrains+all
Run Code Online (Sandbox Code Playgroud)

但是,.idea 文件夹中的某些文件与 .gitignore 设置不同。所以我留下了这个问题。据我所知,.idea文件夹下的子目录不应该用git注册,但是不知道看到一些文件是否正常。如果这不正常,它会询问您是否要将所有 .idea 文件夹子列表添加到 .gitignore。

下图是从 Github Desktop 截取的图片。

在此处输入图片说明

我会等待一个好的答案。谢谢阅读。

Cod*_*ard 7

这个文件夹没有被忽略的原因,因为它存储了你的项目的配置,并且因为它不是默认的一部分 .gitignore

您可以立即修复它。


从命令行解释如何做,也可以通过 IDEA 来完成。

# Once the files are committed adding them to .gitignore will not help,
# you must remove them from the index
# Remove the file from the repository
git rm --cached .idea/

# now update your gitignore file to ignore this folder
echo '.idea' >> .gitignore

# add the .gitignore file to your index
git add .gitignore

git commit -m "Removed .idea files"
git push origin <branch>
Run Code Online (Sandbox Code Playgroud)