首页 > 解决方案 > 如何在没有加密密钥的情况下禁用 8.1 中的锁定文件

问题描述

我删除了具有 .git 文件夹的统一项目并要求我创建一个加密密钥我不知道为什么它要求我这样做,现在当我尝试在 git 中添加文件时它拒绝添加任何东西并提示这个错误

The file will have its original line endings in your working directory
error: open("Temp/UnityLockfile"): Permission denied
error: unable to index file 'Temp/UnityLockfile'
fatal: adding files failed

任何建议

标签: windowsencryption

解决方案


In general the Temp folder is one of the things you do NOT want to be under version control! It should be ignored as mentioned by the first comment! Use this .gitignore file in the root folder of your git project!

Also see Cleaning up and Migrating existing Unity project into new one or another PC where I explained it a bit more in detail and also how to copy your project with only the necessary files.

As said if there is no such file yet simply create it, otherwise adopt the content accordingly.

Also refer to How can I make Git "forget" about a file that was tracked, but is now in .gitignore?.


In your specific case here the error itself is caused because you currently have your project opened in Unity.

In that case there is the - as the name says - LOCK file which ensures you cannot open the same project twice in a second Unity instance.

This file is locked/owned by the Unity Editor process itself and therefore can't be overwritten/accessed by git at the same time.

Now if for some reason after adding the .gitignore file mentioned above this issue still persists you can close Unity, manually delete the Temp folder, make your git merge and reopen Unity.


推荐阅读