返回介绍

Clone filters (partial clone)

发布于 2021-03-20 13:44:26 字数 2326 浏览 1006 评论 0 收藏 0

Git introduces --filter option to git clone command, which filters out large files and objects (such as blobs) to create partial clone of a repo. Clone filters are especially useful for large repo and/or metered connection, where full clone (without --filter) can be expensive (as all history data must be downloaded).

This requires Git version 2.22 or later, both on the Gitea server and on the client. For clone filters to work properly, make sure that Git version on the client is at least the same as on the server (or later). Login to Gitea server as admin and head to Site Administration -> Configuration to see Git version of the server.

By default, clone filters are disabled, which cause the server to ignore --filter option.

To enable clone filters on per-repo basis, edit the repo’s config on repository location. Consult ROOT option on repository section of Gitea configuration (app.ini) for the exact location. For example, to enable clone filters for some-repo, edit /var/gitea/data/gitea-repositories/some-user/some-repo.git/config and add:

[uploadpack]
	allowfilter = true

To enable clone filters globally, add that config above to ~/.gitconfig of user that run Gitea (for example git).

Alternatively, you can use git config to set the option.

To enable for a specific repo:

cd /var/gitea/data/gitea-repositories/some-user/some-repo.git
git config --local uploadpack.allowfilter true

To enable globally, login as user that run Gitea and:

git config --global uploadpack.allowfilter true

See GitHub blog post: Get up to speed with partial clone for common use cases of clone filters (blobless and treeless clones), and Gitlab docs for partial clone for more advanced use cases (such as filter by file size and remove filters to turn partial clone into full clone).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文