.gitignore for xcuserdata文件夹中的所有内容都不会忽略xcuserstate文件

Fer*_*ndo 30 git xcode gitignore

我在Xcode项目中工作,我正在尝试配置.gitignore以获取xcuserdata文件夹中的任何内容.

我有以下.gitignore:

# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
xcuserdata/*
Run Code Online (Sandbox Code Playgroud)

但每次我构建/运行项目并执行时git status,它仍会显示以下中间文件:

modified: MyProject.xcodeproj/project.xcworkspace/xcuserdata/fernando.xcuserdatad/UserInterfaceState.xcuserstate
Run Code Online (Sandbox Code Playgroud)

有人知道什么是错的吗?

Fer*_*ndo 33

我找到了解决方案

问题不在.gitignore文件中

问题是没有从git服务器中删除的UserInterfaceState.xcuserstate,在以下链接中找到了解决方案:

不能忽略UserInterfaceState.xcuserstate


小智 10

*.xcuserstate除了添加到文件之外.gitignore,请记住删除缓存的*.xcuserstate

git rm --cached [YourProjectName].xcodeproj/project.xcworkspace/xcuserdata/[ YourUsername].xcuserdatad/UserInterfaceState.xcuserstate

https://www.programmerought.com/article/1594916500/


nfe*_*s76 9

附加信息

我也遇到过这种情况并且似乎不起作用,因为 .gitignore 在提交后仍然添加它们。我添加的东西对我来说很有吸引力

.... 这不能被 .gitignore 读取:

xcuserdata/*
Run Code Online (Sandbox Code Playgroud)

添加这对我有用:

*xcworkspace/xcuserdata/*
Run Code Online (Sandbox Code Playgroud)

或阅读:

*/xcuserdata/*
Run Code Online (Sandbox Code Playgroud)

  • `*xcworkspace/xcuserdata/*` 为我工作!谢谢你! (2认同)

Ant*_*ony 6

除了这个对我来说没有任何作用,因为我想提交其中也有 .xcuserdata 的 Pod:

**/xcuserdata/*
Run Code Online (Sandbox Code Playgroud)