This commit is contained in:
2025-08-02 12:09:34 +08:00
commit e70b01cdca
2785 changed files with 575579 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
#### 前言
因为GameplayAbility属于蓝图c++混合编程框架所以对蓝图类与地图进行版本管理是十分重要的事情。所以本文将在这里介绍git的二进制文件版本管理方案。
#### 使用过程
1. 下载Gitlfshttps://git-lfs.github.com/~~(现在的git都自带lfs就算没有下个SourceTree也会自带lfs)
2. 使用cmdcd到git仓库所在目录执行git lfs install。一般人都在这一步做错如果做错会存在100mb的文件大小限制
3. 此时目录下会出现.gitattributes文件它用于设置监视的扩展名你可以通过输入```git lfs track "*.扩展名"```的方式来添加扩展名。例如想要监视uasset就输入
```git lfs track "*.uasset"```。最后将.gitattributes加入进版本管理```git add .gitattributes```。
4. 现在你就可以用与管理代码文件相同的方式,管理二进制文件了。
```
git add file.uasset
git commit -m "Add design file"
git push origin master
```
推荐使用SourceTree因为如果你第二步操作有误或是第三步没有添加扩展名它会提醒你的。
#### 蓝图合并与Diff工具
Mergehttps://github.com/KennethBuijssen/MergeAssist
Diffhttps://github.com/SRombauts/UE4GitPlugin
# Git Clone --depth 1 以及转化成完整仓库
git clone --depth 1 https://github.com/EpicGames/UnrealEngine.git
git clone --depth 1 --branch 4.25-plus https://github.com/EpicGames/UnrealEngine.git
转换成完整仓库的方法:
git pull --unshallow
再执行命令修改fetch设置获取所有分支即可。
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
# LFS upload missing objects 解决
输入命令,即可
```
git config --global lfs.allowincompletepush false
```
# LFS删除 很久不用的文件
使用prune命令可以删除LFS中的旧文件。
```
git lfs prune options
```
这会删除认为过旧的本地 Git LFS文件没有被引用的文件被认为是过旧的文件
当前切换的提交
一个还没有被推送的提交到远程或者任何在lfs.pruneremotetocheck设置的
一个最近的提交
默认,一个最近的提交是过去十天的任何一个提交,这是通过添加如下内容计算的:
在获取附加的Git LFS历史部分讨论过的lfs.fetchrecentrefsdays属性的值。
lfs.pruneoffsetdays属性的值默认为3
git lfs prune
你可以为配置一个持用Git LFS内容更长的时间
# don't prune commits younger than four weeks (7 + 21)
$ git config lfs.pruneoffsetdays 21
不像Git内置的垃圾回收 Git LFS内容不会自动删除因此定期执行git lfs prune来保留你本地的仓库文件大小是很正确的做法。
你可以测试在git lfs prune dry-run命令执行后有什么效果
$ git lfs prune --dry-run
✔ 4 local objects, 33 retained
4 files would be pruned (2.1 MB)
更精确地查看哪个Git LFS对象被删除可以使用git lfs prune verbose dry-run命令
$ git lfs prune --dry-run --verbose
✔ 4 local objects, 33 retained
4 files would be pruned (2.1 MB)
* 4a3a36141cdcbe2a17f7bcf1a161d3394cf435ac386d1bff70bd4dad6cd96c48 (2.0 MB)
* 67ad640e562b99219111ed8941cb56a275ef8d43e67a3dac0027b4acd5de4a3e (6.3 KB)
* 6f506528dbf04a97e84d90cc45840f4a8100389f570b67ac206ba802c5cb798f (1.7 MB)
* a1d7f7cdd6dba7307b2bac2bcfa0973244688361a48d2cebe3f3bc30babcf1ab (615.7 KB)
通过使用verbose模式输出的十六进制的字符串是被删除的Git LFS对象的SHA-256哈希值也被称作对象ID,或者OIDs。你可以使用在找到引用某个Git LFS对象的路径或者提交章节介绍的技巧去找到其他想要删除的对象。
作为一个额外安全检查工作你可以使用verify-remote选项来检查Git LFS store是否存在想要删除的Git LFS对象的拷贝。
$ git lfs prune --verify-remote
✔ 16 local objects, 2 retained, 12 verified with remote
Pruning 14 files, (1.7 MB)
✔ Deleted 14 files
这让删除过程非常的非常的缓慢但是这可以帮助你明白所有删除的对象都是可以从服务器端恢复的。你可以为你的系统用久开启verify-remote 选项这可以通过全局配置lfs.pruneverifyremotealways属性来实现。
$ git config --global lfs.pruneverifyremotealways true
或者你可以通过去掉global选项来仅仅为当前会话的仓库开启远程验证。
# Git代理
## 配置Sock5代理
git config -global http.proxy socks5://127.0.0.1:2080
git config -global https.proxy socks5://127.0.0.1:2080
### 只对github.com
git config --global http.https://github.com.proxy socks5://127.0.0.1:2080
git config --global https.https://github.com.proxy socks5://127.0.0.1:2080
### 取消代理
git config --global --unset http.https://github.com.proxy)
git config --global --unset https.https://github.com.proxy)
## 增加超时时间
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags origin GamePlayDevelop:GamePlayDevelop
Pushing to https://github.com/SDHGame/SDHGame.git
LFS: Put "https://github-cloud.s3.amazonaws.com/alambic/media/321955229/b6/a8/b6a8fa2ba03f846f04af183bddd2e3838c8b945722b298734a14cf28fd7d1ab1?actor_id=12018828&key_id=0&repo_id=325822904": read tcp 127.0.0.1:56358->127.0.0.1:1080: i/o timeout
LFS: Put "https://github-cloud.s3.amazonaws.com/alambic/media/321955229/76/47/76473fed076cd6f729cf97e66e28612526a824b92019ef20e3973dc1797304e8?actor_id=12018828&key_id=0&repo_id=325822904": read tcp 127.0.0.1:56360->127.0.0.1:1080: i/o timeout
LFS: Put "https://github-cloud.s3.amazonaws.com/alambic/media/321955229/78/a0/78a0819db84cdd0d33aa176ae94625515059a6c88fec5c3d1e905193f65bfcdd?actor_id=12018828&key_id=0&repo_id=325822904": read tcp 127.0.0.1:56374->127.0.0.1:1080: i/o timeout
LFS: Put "https://github-cloud.s3.amazonaws.com/alambic/media/321955229/24/ab/24ab214470100011248f2422480e8920fb80d23493f11d9f7a598eb1b4661021?actor_id=12018828&key_id=0&repo_id=325822904": read tcp 127.0.0.1:56376->127.0.0.1:1080: i/o timeout
Uploading LFS objects: 99% (712/716), 210 MB | 760 KB/s, done.
error: failed to push some refs to 'https://github.com/SDHGame/SDHGame.git'
git config --global lfs.tlstimeout 300
git config --global lfs.activitytimeout 60
git config --global lfs.dialtimeout 600
git config --global lfs.concurrenttransfers 1
### LFS Upload Failed (miss) 文件路径
解决方案下载所有LFS数据git lfs fetch --all
### 服务器上不存在
解决方案上传指定lfs文件git lfs push origin --object-id [ID]
### LFS objects are missing on push[](https://docs.gitlab.com/ee/topics/git/lfs/troubleshooting.html#lfs-objects-are-missing-on-push "Permalink")
GitLab checks files on push to detect LFS pointers. If it detects LFS pointers, GitLab tries to verify that those files already exist in LFS. If you use a separate server for Git LFS, and you encounter this problem:
1. Verify you have installed Git LFS locally.
2. Consider a manual push with `git lfs push --all`.
### 强制上传LFS
git lfs push origin --all
### I/O timeout when pushing LFS objects[](https://docs.gitlab.com/ee/topics/git/lfs/troubleshooting.html#io-timeout-when-pushing-lfs-objects "Permalink")
If your network conditions are unstable, the Git LFS client might time out when trying to upload files. You might see errors like:
```
LFS: Put "http://example.com/root/project.git/gitlab-lfs/objects/<OBJECT-ID>/15":
read tcp your-instance-ip:54544->your-instance-ip:443: i/o timeout
error: failed to push some refs to 'ssh://example.com:2222/root/project.git'
```
To fix this problem, set the client activity timeout a higher value. For example, to set the timeout to 60 seconds:
```
git config lfs.activitytimeout 60
```
# 引擎Content管理
.gitignore文件中添加
```
Content/
#Content/
!*.uasset
**/Content/*
**/Content/*/*
!**/Content/EngineMaterials/
!**/Content/EngineMaterials/ToonTexture/
```
# 解决git UTF8文件乱码问题
问题:
```bash
未处理的异常System.ArgumentException: Path fragment '“Content/\351\237\263\351\242\221/Cheetah\302\240Mobile_Games_-_\347\254\254\345\215\201\344 \270\203\345\205\263\302\240Cube\302\240\345\207\240\344\275\225\350\277\267\351\230\265.uasset”包含无效的目录分隔符.
1> 在 Tools.DotNETCommon.FileSystemReference.CombineStrings(DirectoryReference BaseDirectory, String[] Fragments)
1> 在 Tools.DotNETCommon.FileReference.Combine(DirectoryReference BaseDirectory, String[] Fragments)
1> 在 UnrealBuildTool.GitSourceFileWorkingSet.AddPath(String Path)
1> 在 UnrealBuildTool.GitSourceFileWorkingSet.OutputDataReceived(Object Sender, DataReceivedEventArgs Args)
1> 在 System.Diagnostics.Process.OutputReadNotifyUser(String data)
1> 在 System.Diagnostics.AsyncStreamReader.FlushMessageQueue()
1> 在 System.Diagnostics.AsyncStreamReader.GetLinesFromStringBuilder()
1> 在 System.Diagnostics.AsyncStreamReader.ReadBuffer(IAsyncResult ar)
1> 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
1> 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
1> 在 System.IO.Stream.ReadWriteTask.System.Threading.Tasks .ITaskCompletionAction.Invoke(Task completingTask)
1> 在 System.Threading.Tasks.Task.FinishContinuations()
1> 在 System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
1> 在 System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
1> 在 System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
1> 在 System.Threading.ThreadPoolWorkQueue.Dispatch()
```
```bash
git config --global core.quotepath false
```