Publish local Git repository to Team Foundation Service

前端 未结 12 644
灰色年华
灰色年华 2020-12-13 14:33

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

相关标签:
12条回答
  • 2020-12-13 15:07

    I found it helped to start a new solution and publish from there going step by step.

    Once it's 'confused' itself it's best to start the process over. I got it working and never had to edit that file.

    0 讨论(0)
  • 2020-12-13 15:08

    I had the same issue. I had to delete all of my remotes in .git/config (not just origin) before the Publish option is available. Apparently, Microsoft assumes you would never even dream of using a different remote.

    0 讨论(0)
  • 2020-12-13 15:09

    I can confirm other answers, that the GIT repo cannot have any remotes listed or VS13 won't add it to the team project. I was using Atlassian tools Stash / Bitbucket / SourceTree and as soon as I closed VS13, removed all the remotes, reopenened VS13, opened the team project, and right clicked on my local GIT repo. The option "Publish to {teamProject}" was available and the .sln was then available by opening the team project.

    0 讨论(0)
  • 2020-12-13 15:11

    For submitting an existing local repository to TFS-Git:

    • Create new project in TFS.
    • Using Git Extensions, select the local repository that you want to push to your new project in TFS.
    • Select the push arrow.
    • Select Manage remotes.
    • In URL, enter the location of your TFS project: https://[your site name].visualstudio.com/DefaultCollection/_git/[Your project name]
    • Save. Do you want to automatically configure push and pull? (I said yes.)
    • Close.
    • Select dropdown box for Remote - select the Remote URL you just saved.
    • Push.

    While setting up my account at TFS, I did set up an alternate credentials, though I am not sure if they were needed for this process.

    I am new to GIT and TFS, but this process allowed my to push two of my solutions, each with three projects into TFS. Also, within Git Extensions, I found that I could organize my local repositories into categories, which proved a convenient way to organize my projects into their solutions. I would like to do the same in TFS, too.

    0 讨论(0)
  • 2020-12-13 15:15

    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.
      • Go to your project in the TFS web interface, then Code tab.
      • You should get a message that gives you the URL.
      • e.g. https://user.visualstudio.com/DefaultCollection/_git/YourProject
    • 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.

    0 讨论(0)
  • 2020-12-13 15:15

    I tried all of the above but the only way I could get it to work was to use git hub for windows.

    To make that work you will need to set up alternate credentials. https://tfs.visualstudio.com/en-us/home/news/2012/aug-27/

    0 讨论(0)
提交回复
热议问题