git 远程包文件大于本地包文件

标签 git

我在我的服务器上使用 gitlab 主机。 在服务器上,一个仓库的打包文件大小是500MB,但是当我把它克隆到本地时,我发现本地的打包文件大小是250MB。这是个问题吗?

最佳答案

One the server, one repository's pack file size is 500MB, but when I clone it to local, I find the local pack file size is 250MB. Is this a problem?

远程服务器和本地服务器上的包大小可能不同。
这根本不是问题,但如果您的包文件很大,您的存储库性能将会受到影响。

每次 git 提交代码时,它也应该被添加到包中。 Git 将数据存储在 2 个主要文件中。 .pack && .idx .打包文件是存储库的内容,而索引是内容到文件名之间的映射。

如果您愿意在 .git/objects/pack 下查看你可能会看到几个包文件。
在这种情况下,您应该“告诉”git 使用以下命令优化存储库:

git gc --aggressive --prune=now

此命令将重新打包存储库的内容,并带有 --prune=now 选项。它将“ super ”优化您的存储库大小。

--prune=<date>

Prune loose objects older than date (default is 2 weeks ago, overridable by the config variable gc.pruneExpire). --prune=all prunes loose objects regardless of their age. --prune is on by default.

关于git 远程包文件大于本地包文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35097529/

相关文章:

git - 如何使用 BFG repo cleaner 删除一个文件夹/目录?

GIT:提交时在文件中包含当前提交哈希和最新标记

git - 如果我将其他人的私有(private) Github 存储库 fork 到我的帐户中,它是否会作为公共(public)存储库出现在我的帐户中?

git - 由于默认设置,从 VSCode Remote-Container 到 AWS CodeCommit 存储库的连接失败

Git子树拆分两个目录

git - 如何为 Git 远程 URL 使用环境变量

Git:如何更改远程存储库上的事件分支?

php - 创建、配置 PHP Web 应用并将其部署到 Azure

r - 如何从 R 脚本中将更改提交到 GitHub?

git - heroku 应用程序上的应用程序错误