简体   繁体   English

Team Foundation Server 2015(tfs2015)在org / remote上运行git gc --prune = now

[英]Team Foundation Server 2015 (tfs2015) run git gc --prune=now on orgin/remote

Is there a way to run git gc --prune=now on remote Team Foundation Server 2015 (tfs2015)? 有没有办法在远程Team Foundation Server 2015(tfs2015)上运行git gc --prune=now Or is the only way to run git gc --prune=now locally then create new repository on tfs2015 and push it to new remote, then delete the old repository, and rename new repository to old name. 或者是在本地运行git gc --prune=now ,然后在tfs2015上创建新存储库并将其推送到新的远程服务器,然后删除旧存储库,并将新存储库重命名为旧名称的唯一方法。 Don't forget to turn off the liking commit when doing that. 这样做时,请不要忘记关闭喜欢的提交。

See https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/ - this is a known limitation of TFS-hosted git, it doesn't have the gc command. 请参阅https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/-这是TFS托管git的已知限制,它没有gc命令。

Microsoft provides two workarounds: Microsoft提供了两种解决方法:

  • clone the repo, clean it locally, delete it from the server, create a new one and push your cleaned one to it (what you described in your question) 克隆仓库,在本地清理,从服务器中删除,创建一个新仓库,然后将清理后的仓库推送到仓库(问题描述)
  • don't git clone , but obtain your local repo like this: 不要git clone ,而是像这样获取本地存储库:

     mkdir newRepo git init git remote add origin #fetch one branch first git fetch origin master #fetch everything else git fetch origin 

    which tricks TFS to actually send you only the objects you really need. 这会诱使TFS实际仅向您发送您真正需要的对象。

Option 1 seems to be more reasonable to me if you can afford losing your pull requests etc (eg if this is a relatively new repo). 如果您可以承受丢失拉取请求等费用(例如,如果这是一个相对较新的回购协议),那么对我来说,选项1似乎更合理。

Option 2 feels really bad, as any user of the repo will have to manually create their clone this way. 选项2真的很糟糕,因为回购协议的任何用户都必须以这种方式手动创建其克隆。

Update about comming this in TFS v.Next And all ready rolled out in VSTS https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old-unreferenced-objects/ "UPDATE (2017-08-09): We rolled out commit reachability bitmap indexes to VSTS and removed the clone cheat mentioned below. Cloning will no longer download unreachable objects!. We still don't have true object-level git gc on the server yet, but clone sizes will be smaller now. 有关在TFS v.com中添加此功能的更新,下一步并准备在VSTS中全部推出https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-cloning-from-vsts-return-old- unreferenced-objects / “更新(2017-08-09):我们将提交可访问性位图索引推出到VSTS,并删除了下面提到的克隆作弊。克隆将不再下载无法访问的对象!。我们仍然没有真正的对象级git gc在服务器上还没有,但是现在克隆大小会更小。

TFS on-prem will get these changes in v.Next (not in any TFS 2017 updates, but the next major release). TFS本地版本将在v.Next中获得这些更改(不是在任何TFS 2017更新中,而是在下一个主要版本中)。 As Brian Harry mentioned, we should have a release candidate for v.Next in a few weeks." 正如布赖恩·哈里(Brian Harry)所言,我们应该在几周内找到v.Next的候选发布者。”

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

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