【发布时间】:2018-10-29 21:53:48
【问题描述】:
我正在运行一个网站,并部署了 Git 进行文件版本控制以跟踪编辑的文件...我注意到甚至缓存文件都被推送到了我不想要的 Gitlab。
我创建了一个 .gitignore 文件并写了这样一行:
/app/cache/dev/smarty/compile/*
我添加它,承诺并推动它,生活是美好的。
现在,每次我这样做:git status,我都会看到这些文件被修改,它们正在浏览缓存
modified: app/cache/dev/smarty/compile/00/7c/14/007c1437400d132932e061d38915162f50f3b8d7.file.ApProductList.tpl.php
modified: app/cache/dev/smarty/compile/11/0e/c7/110ec72aa9921d2c382ad628bdb2f0bc5105a617.module.ps_searchbar.tpl.php
modified: app/cache/dev/smarty/compile/14/cf/62/14cf62b857ae9d1a45052e93e4a5f7744c543c46.file.ApMegamenu.tpl.php
modified: app/cache/dev/smarty/compile/15/9c/65/159c651fcb923e7ff3efcd17bc6356e6f77d1032.file.leoslideshow.tpl.php
modified: app/cache/dev/smarty/compile/18/2a/ea/182aea6706a2d4ae5bfc3f6d3a5b33417c49b6af.module.notification.tpl.php
modified: app/cache/dev/smarty/compile/24/41/64/24416476c1e4c535f73ed4c66a125c0e880f294b.file.leo_list_product_review.tpl.php
modified: app/cache/dev/smarty/compile/30/7d/c6/307dc6bd4724d29d1572cc301dd7148e962604ef.module.ps_emailsubscription.tpl.php
modified: app/cache/dev/smarty/compile/32/74/ea/3274eac0d659ac48de29176349457a485f0a7846.file.ApBlockLink.tpl.php
modified: app/cache/dev/smarty/compile/35/65/5e/35655e6409b6198f29dd6e732ef9598dec599880.module.ps_shoppingcart.tpl.php
modified: app/cache/dev/smarty/compile/38/37/a8/3837a8fdc3367fa8be15dd17f53842319311023b.file.plist1487280701.tpl.php
modified: app/cache/dev/smarty/compile/39/e1/75/39e175b351bd73dee402d5a54877d3be6344bbe4.file.leo_cart_button.tpl.php
modified: app/cache/dev/smarty/compile/3b/2b/08/3b2b08f3e7cd22b2aad86e184d6bdfdc8b3802cf.module.modal.tpl.php
modified: app/cache/dev/smarty/compile/43/80/cd/4380cd32bf825479f4e58e8f1a26818a8f607913.file.ApHtml.tpl.php
modified: app/cache/dev/smarty/compile/51/3e/9c/513e9ce13e7d8790fecede8bcf00cdc8ca0ef171.file.slidecaptcha-header.tpl.php
modified: app/cache/dev/smarty/compile/5a/51/17/5a5117cf6d0e1dffe864e8c6e12c7c631b3df555.file.ApColumn.tpl.php
modified: app/cache/dev/smarty/compile/5e/b2/05/5eb205658affb81ad209afd041b5ce7f724c9288.file.appagebuilder.tpl.php
modified: app/cache/dev/smarty/compile/75/be/84/75be842c1b804d7817967aceea1b33cc9f212c84.file.ApModule.tpl.php
modified: app/cache/dev/smarty/compile/80/5c/e2/805ce2d86f1187d802d55b829fd8b831e391ad7c.module.fly_cart.tpl.php
modified: app/cache/dev/smarty/compile/80/ac/9d/80ac9ddb06fe7b43ffdd2f5cd1185536480d2577.module.ps_socialfollow.tpl.php
modified: app/cache/dev/smarty/compile/8d/87/67/8d87672f84fea39023a026ec3e77c50d0205b84a.file.megamenu.tpl.php
modified: app/cache/dev/smarty/compile/94/3d/87/943d870759e124a38846d736284d297b82268471.file.ApSlideShow.tpl.php
modified: app/cache/dev/smarty/compile/97/9d/97/979d976ed6034e059eef22b8e951012b4262674e.file.ApManuFacturersCarousel.tpl.php
modified: app/cache/dev/smarty/compile/99/f1/47/99f147cdc5f8fa7776be7f182bac4542c4e7954c.file.ApProductCarousel.tpl.php
modified: app/cache/dev/smarty/compile/9d/30/9b/9d309b84d5f56fc52e6632a8d91893c2f5a67658.file.javascript_parameter.tpl.php
这是一个很长的列表,如何通过忽略它们来停止推送这些文件,我可能忘了做点什么?
【问题讨论】:
-
试试命令 git rm --cached -r
-
如果这些特定文件在您添加 gitignore 之前已被跟踪和提交,那么您可以手动删除它们并将其作为提交推送。之后他们就不会出现了。
-
显然是Git is ignoring you, not your files。也可能不是。