You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

拉取Unreal Engine 5分支后本地Git仓库被锁定的解决问询

UE5仓库文件只读导致VS构建失败

我首次拉取EpicGames的Unreal Engine 5仓库(开发分支ue5-main),并创建了本地分支katianie-ue5-main。但在Visual Studio中构建项目时,所有文件都提示访问被拒绝,Windows资源管理器显示所有文件均为只读状态。手动取消文件夹的只读属性后没有效果,请问有没有解锁文件夹的方法?Git Desktop有没有相关的checkout操作可以解决这个问题?

相关截图

  • Git Desktop界面:Git Desktop界面截图
  • Windows资源管理器只读状态:Windows资源管理器只读状态截图

Git状态信息

Refresh index: 100% (178229/178229), done.
On branch katianie-ue5-main
Your branch is up to date with 'origin/katianie-ue5-main'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted:    Engine/Binaries/Linux/UnrealBuildAccelerator/.dockerignore
deleted:    Engine/Binaries/Linux/UnrealBuildAccelerator/Dockerfile
deleted:    Engine/Extras/VirtualProduction/FlutterLiveLinkVCAM/assets/eula.html
deleted:    Engine/Source/ThirdParty/ShaderConductor/ShaderConductor/External/DirectXShaderCompiler/utils/git/code-format-helper.py
deleted:    Engine/Source/ThirdParty/ShaderConductor/ShaderConductor/External/DirectXShaderCompiler/utils/git/code-format-save-diff.py
deleted:    Engine/Source/ThirdParty/ShaderConductor/ShaderConductor/External/DirectXShaderCompiler/utils/git/requirements_formatting.txt

Untracked files:
(use "git add <file>..." to include in what will be committed)
Engine/Binaries/DotNET/UnrealBuildTool.Tests/
Engine/Source/Programs/AutomationTool.Tests/bin/

no changes added to commit (use "git add" and/or "git commit -a")

分支信息

* katianie-ue5-main                           ca4d8114db32 [PCG] Add warning when trying to import an alembic file with no point cloud data or no points.
  release                                     16dc333db3d6 5.4.1 release
  ue5-main                                    ca4d8114db32 [PCG] Add warning when trying to import an alembic file with no point cloud data or no points.
  remotes/origin/4.0                          dd065b230564 Engine source for 4.0.2 (4.0 branch up to CL 2034640)
  remotes/origin/4.1                          9b460da0ad7f Code snapshot for CL 2061508
  remotes/origin/4.10                         82c6eea53830 Rebuilt binaries for promoted changelist 2872498.
  remotes/origin/4.11                         c0df86062ad4 Back-port fix for mismatched argument errors compiling precompiled headers in VS2015 update 3.
  remotes/origin/4.12                         fd7794c48b37 Updating path for Rocket builds in 4.12 branch in case we do another hotfix release.
  remotes/origin/4.13                         aaf118e0c108 fix for FramePacer on iOS #rb none #lockdown nick.penwarden #jira UE-37704
  remotes/origin/4.14                         6957dd274b94 [Localization Update] Project: Engine Target: Keywords
  remotes/origin/4.15                         12d23e7ac4c2 Branch snapshot for CL 3451409
  remotes/origin/4.16                         37ca478f5aa3 Localization Automation
  remotes/origin/4.17                         db813ce277df Localization Automation
  remotes/origin/4.18                         de25f76316ed Copy xbox one mip corruption fix from dev-console CLs 3801550 and 3768615.
  remotes/origin/4.19                         ea87f4fb26ff License Check-in for WebCamAndVideo
  remotes/origin/4.2                          4225a79ca5ea Updated README.MD for 4.2.1 release
  remotes/origin/4.20                         5c73d9fb0afb Localization Automation
  remotes/origin/4.21                         7acbae1c8d17 Branch snapshot for CL 4972232
  remotes/origin/4.22                         8fb368305d69 Localization Automation
  remotes/origin/4.23                         87f8792983fb Localization Automation
  remotes/origin/4.24                         5502af308632 Branch snapshot for CL 11596182
  remotes/origin/4.25                         cede3321b23e Branch snapshot for CL 14826844
  remotes/origin/4.25-plus                    2d1aaeede678 Branch snapshot for CL 16138940

解决方法

1. 重置Git文件权限

进入仓库根目录,打开Git Bash或命令提示符,执行:

git config core.filemode false
git reset --hard HEAD

这条命令会修正Git管理的文件权限,并将本地文件重置为当前分支的最新状态,解决因Git权限标记导致的只读问题。

2. 强制清除Windows只读属性

  • 右键仓库文件夹→属性,取消只读勾选,点击应用,选择将更改应用于此文件夹、子文件夹和文件后确定。
  • 若上述操作无效,以管理员身份打开命令提示符,执行:
attrib -r -s /d /s "你的UE5仓库完整路径\*"

该命令会递归移除整个仓库的只读和系统属性。

3. Git Desktop操作步骤

  • 点击仓库分支下拉菜单,选择ue5-main分支并点击Checkout,回到干净的远程分支状态。
  • 重新创建本地分支katianie-ue5-main(确保基于未修改的ue5-main)。
  • 或者直接在Repository菜单中选择Discard All Changes,一键重置本地文件状态。

4. 构建前置检查

  • 必须以管理员身份运行Visual Studio,避免系统权限限制。
  • 确保仓库路径无中文、空格或特殊字符,建议使用纯英文路径。

内容的提问来源于stack exchange,提问作者Katianie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 20:25:17