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

查看:585
本文介绍了Team Foundation Server 2015(tfs2015)在orgin / remote上运行git gc --prune = now的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在远程Team Foundation Server 2015(tfs2015)上运行 git gc --prune = now ?或者是在本地运行 git gc --prune = now 的唯一方法,然后在tfs2015上创建新的存储库并将其推送到新的远程,然后删除旧的存储库并重命名新的资料库到旧名称。不要忘了在做这些时关闭喜欢的提交。

解决方案

请参阅 https://blogs.msdn.microsoft.com/congyiw/2015/12/14/why-does-克隆从vsts-return-old-unreferenced-objects / - 这是TFS托管的git的一个已知限制,它没有 gc 命令。



Microsoft提供了两种解决方法:


  • 克隆回购,清理它在本地,从服务器上删除它,创建一个新的,并将你的清洁的一个(你在你的问题中描述)

  • 不要

      mkdir newRepo 
    git init git clone

    git remote add origin
    #fetch第一个分支
    git fetch原点大师
    #fetch其他所有
    git获取原点

    这个技巧让TFS实际上只向你发送obj如果你能够承受失去你的拉动要求等,选项1似乎对我来说更合理了。

  • (例如如果这是一个相对较新的回购)。



    选项2感觉非常糟糕,因为任何回购用户都必须以这种方式手动创建他们的克隆。


    Is there a way to run git gc --prune=now on remote Team Foundation Server 2015 (tfs2015)? 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. 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.

    Microsoft provides two workarounds:

    • 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:

      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.

    Option 1 seems to be more reasonable to me if you can afford losing your pull requests etc (e.g. if this is a relatively new repo).

    Option 2 feels really bad, as any user of the repo will have to manually create their clone this way.

    这篇关于Team Foundation Server 2015(tfs2015)在orgin / remote上运行git gc --prune = now的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆