简体   繁体   English

每次Eclipse远程同步时,Git存储库大小都会增加

[英]Git repository size increases on every Eclipse remote synchronization

I'm using Eclipse Remote synchronization to upload a PHP project from my Windows workstation to FreeBSD VM, where my web server is running. 我正在使用Eclipse Remote同步将PHP项目从我的Windows工作站上传到我的Web服务器正在运行的FreeBSD VM。 In order to make the synchronization Eclipse create on both machines .ptp-sync directory where stores the git objects. 为了使同步Eclipse在两台机器上创建.ptp-sync目录,用于存储git对象。

Initially the project is ~1MB. 最初该项目约为1MB。 But after every save (which triggers sync) this size increases to 2MB, 3MB, 5MB, 10MB etc, on both machines. 但是在每次保存(触发同步)后,这两个机器上的这个大小增加到2MB,3MB,5MB,10MB等。 After a couple of synchronizations it goes through hundreds of MB, to GBs. 经过几次同步后,它会通过数百MB到GB。 Once it reaches even 11GB. 一旦达到甚至11GB。 Of course the synchronization starts to take, instead 1-2 sec as it is initially, 1-2min. 当然,同步开始采取,而不是最初1-2秒,1-2分钟。 In such cases I should delete both .ptp-sync dirs and init Eclipse sync again. 在这种情况下,我应该再次删除.ptp-sync dirs和init Eclipse sync。

I notice that the largest files are in .ptp-sync\\objects\\pack\\ 我注意到最大的文件是在.ptp-sync \\ objects \\ pack \\

My last test, after 3 saves (and syncs) the repo increase steps were 77MB - 138MB - 267MB - 396MB. 我的最后一次测试,在3次保存(和同步)后,回购增加步骤为77MB - 138MB - 267MB - 396MB。 Just before that I try 就在那之前我试试

git -C .ptp-sync --work-tree=. gc --prune

which reduces the size from 140MB to 77MB, but after 396MB it doesn't reduce anything. 它将大小从140MB缩小到77MB,但在396MB之后它不会减少任何东西。 Next save make the repo 779MB. 下一步保存回购779MB。

One of my guesses was that it is not ignoring .ptp-sync which causes to push it everytime, although there is /.ptp-sync in .gitignore file, and also in Eclipse Preferences->Remote Development->Synchronized Projects->File Filtering. 我的一个猜测是它不会忽略.ptp-sync导致每次都推送它,尽管.gitignore文件中有/.ptp-sync,还有Eclipse Preferences-> Remote Development-> Synchronized Projects-> File过滤。

PS Ah, and of course this does not happen on my colleague setup which is prity the same - he also uses Windows and Eclipse with a copy of the same VM. PS啊,当然这不会发生在我的同事设置上,这是同样的 - 他也使用Windows和Eclipse与同一个VM的副本。

I figure out how to handle this situation. 我弄清楚如何处理这种情况。 As I guess the .ptp-sync directory even it was added into .gitignore it wasn't actually ignored, and this cause its recommit on every repack. 正如我猜的.ptp-sync目录,即使它被添加到.gitignore中,它实际上并没有被忽略,这导致它在每次重新包装时重新发送。

The solution is to add into .ptp-sync/info/exclude the row /.ptp-sync/ . 解决方案是添加到.ptp-sync / info / exclude行/.ptp-sync/ Maybe the synchronization doesn't use .gitignore by default. 也许默认情况下同步不使用.gitignore。

For different ways of ignoring files, the following link can give some info: https://help.github.com/articles/ignoring-files/ 对于忽略文件的不同方式,以下链接可以提供一些信息: https//help.github.com/articles/ignoring-files/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM