git gc --aggressive 推送到服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9135095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git gc --aggressive push to server?
提问by Dan Rosenstark
It seems like git gc --aggressive
really cleans up my repo, but when I do git push
everything is already up-to-date. Is there a way to clean up the server?
似乎git gc --aggressive
真的清理了我的 repo,但是当我做的git push
一切都已经是最新的。有没有办法清理服务器?
采纳答案by VonC
I know that Github will run git gc periodically as the Github support mentions in this thread.
我知道 Github 会定期运行 git gc,因为 Github 支持在此线程中提到。
I don't know if you can force it yourself though.
I didn't see such a service in the Github hooks.
不知道你能不能自己勉强。
我在Github hooks 中没有看到这样的服务。
回答by Carl G
I believe that pushing your changes will only add new commits (as necessary to reach the branches you are pushing); it will not delete them. This is corroborated by this github support page on deleting sensitive data:
我相信推送您的更改只会添加新的提交(根据需要到达您正在推送的分支);它不会删除它们。这个 github 支持页面在删除敏感数据时证实了这一点:
Be warned that force-pushing does not erase commits on the remote repository, it simply introduces new ones and moves the branch pointer to point to them. If you are worried about users accessing the bad commits directly via SHA1, you will have to delete the repository and recreate it.
请注意,强制推送不会删除远程存储库上的提交,它只是引入新的提交并移动分支指针以指向它们。如果您担心用户直接通过 SHA1 访问错误提交,则必须删除存储库并重新创建它。
So if you can't wait for GitHub's periodic gc, then you have to recreate.
所以如果你等不及 GitHub 的定期 gc,那你就得重新创建了。
回答by jjlin
You'll have to run the same command on the server side as well. Most people just set up a cron job or similar to do this sort of housekeeping periodically.
您还必须在服务器端运行相同的命令。大多数人只是建立一个 cron 工作或类似的工作来定期进行这种内务管理。