Skip to main content

源代码控制

默认情况下,public 文件夹会被添加到 .gitignore 文件中。这意味着您的录像不会存储在 Git 中。
视频会被保存在本地,只有代码的更改才能被暂存。

我们将此设置为默认,因为 GitHub 不允许大于 1GB 的存储库,您可能会很快遇到错误。

启用 Git LFS 存储

note

我们自己使用 Git LFS,并建议您设置这个。

如果您想将所有录像添加到您的存储库中,您可以使用 Git LFS。

您的 Git 提供商可能会向您收取存储费用。
GitHub 账户包括 1 GiB 的免费存储空间和每月 1 GiB 的免费带宽。
之后,您可以购买一个 50GB 的数据包,价格为 $5.

1. 跟踪 public 文件夹

注释掉 .gitignore 中忽略 public 文件夹的行:

Comment out this line
diff
- public/**/*.{mp4,webm,mov}
+ # public/**/*.{mp4,webm,mov}
Comment out this line
diff
- public/**/*.{mp4,webm,mov}
+ # public/**/*.{mp4,webm,mov}

2. 设置 Git LFS

  1. 下载 Git LFS.
  2. 在您的存储库中初始化 Git LFS:
bash
git lfs install
bash
git lfs install
  1. 配置 Git LFS 跟踪位于 /public 及其所有子文件夹中的所有 .mp4 文件:
bash
git lfs track public/**/*.mp4
bash
git lfs track public/**/*.mp4

3. 提交和推送

bash
git add .gitattributes
git add public
git commit -m "Enable Git LFS"
git push
bash
git add .gitattributes
git add public
git commit -m "Enable Git LFS"
git push