将本地 Git 存储库发布到 Team Foundation Service [英] Publish local Git repository to Team Foundation Service

查看:19
本文介绍了将本地 Git 存储库发布到 Team Foundation Service的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大约一周前,Visual Studio 2012 和 Team Foundation Service 中添加了 Git 支持.我一直在玩它,并想将本地存储库发布到我的团队项目.它在 Team Foundation 服务的第 2 步中进行了描述

  • 编辑本地存储库中的 .git/config 文件.
    • 将远程源配置为指向您的 TFS 存储库.
    • (注意:如果你已经有一个 origin 遥控器,你可能想先重命名它以保留它)
  • 例如

    [远程起源"]url = https://user.visualstudio.com/DefaultCollection/_git/YourRepofetch = +refs/heads/*:refs/remotes/origin/*

    • 在 Visual Studio 中打开您的解决方案.
    • 编辑文件.
    • 提交.
    • 推动一下.

    这应该有望将您的本地存储库推送到您的 TFS 远程作为源.

    从这里开始,事情似乎对我有用——代码在我的 TFS 中至少是 Web 界面,我可以向它推送提交.我可以添加待办事项等.我是 TFS 的新手,所以不确定它是否真的按预期工作.

    About a week ago Git support was added to Visual Studio 2012 and Team Foundation Service. I've been playing around with it a bit and wanted to publish a local repository to my team project. It's described in step 2 on the Team Foundation Service website:

    • Publish your local Git repository into your new team project.

    Now I've been doing the exact same thing, but I don't get the "Publish to ..." context item. Could this be a bug or am I missing something?

    解决方案

    I was having the same problem. I don't know why.

    However, after a bit of playing around, I managed to get the following working. Disclaimer: can't guarantee this is actually the correct way to do it. It may bork things further. And whether it does the same as what the missing 'Publish' menu item is supposed to do, I have no idea. Use at your discretion...

    • Get the url of your git repo in the project you set up in TFS.
    • Edit the .git/config file on your local repo.
      • Configure the origin remote to point to your TFS repo.
      • (note: if you already had an origin remote, you might want to rename that first to keep it)

    e.g.

    [remote "origin"]
        url = https://user.visualstudio.com/DefaultCollection/_git/YourRepo
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    • Open your solution in Visual Studio.
    • Edit a file.
    • Do a commit.
    • Do a push.

    This should hopefully push your local repo to your TFS remote as origin.

    From here things seem to be working for me -- the code is up in my TFS web interface at least, and I can push commits to it. I can add backlog items etc. I'm new to TFS though so not sure if it's actually all working as it should be.

    这篇关于将本地 Git 存储库发布到 Team Foundation Service的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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