我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 将停止服务 此版本的 GitHub Enterprise 已停止服务 2020-01-22. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

将 Git Large File Storage 配置为使用第三方服务器

在 GitHub Enterprise Server 设备上禁用 Git LFS 并使用要存储大型资源的服务器 URL 配置 Git LFS 客户端,即可在第三方服务器上使用 Git Large File Storage (Git LFS)。

默认情况下, Git Large File Storage 客户端在托管 Git 仓库的同一服务器上存储大型资产。 当 Git LFS 在 GitHub Enterprise Server 设备上启用时,大型资产将存储在 /data/user/storage 中的数据分区中。

如果在设备或仓库上禁用了 Git LFS,则用户无法将 Git LFS 资产推送到 GitHub Enterprise Server 。

  1. 在 GitHub Enterprise Server 设备上禁用 Git LFS。 更多信息请参阅“配置 Git Large File Storage”。

  2. 创建指向第三方服务器的 Git LFS 配置文件。

    # Show default configuration
    $ git lfs env
    > git-lfs/1.1.0 (GitHub; darwin amd64; go 1.5.1; git 94d356c)
    > git version 2.7.4 (Apple Git-66)
     
    > Endpoint=https://GITHUB-ENTERPRISE-HOST/path/to/repo/info/lfs (auth=basic)
     
    # Create .lfsconfig that points to third party server.
    $ git config -f .lfsconfig remote.origin.lfsurl https://THIRD-PARTY-LFS-SERVER/path/to/repo
    $ git lfs env
    > git-lfs/1.1.0 (GitHub; darwin amd64; go 1.5.1; git 94d356c)
    > git version 2.7.4 (Apple Git-66)
     
    > Endpoint=https://THIRD-PARTY-LFS-SERVER/path/to/repo/info/lfs (auth=none)
     
    # Show the contents of .lfsconfig
    $ cat .lfsconfig
    [remote "origin"]
       lfsurl = https://THIRD-PARTY-LFS-SERVER/path/to/repo
  3. 为使各用户的 Git LFS 配置相同,请向仓库提交自定义 .lfsconfig 文件。

    $ git add .lfsconfig
    $ git commit -m "Adding LFS config file"
  4. 迁移任何现有的 Git LFS 资源。 更多信息请参阅“迁移到其他 Git Large File Storage 服务器”。

延伸阅读

问问别人

找不到要找的内容?

联系我们