Publish local Git repository to Team Foundation Service

前端 未结 12 645
灰色年华
灰色年华 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:15

    Create the project in VSTS/GitHub/somewhere, then from Git Bash...

    git remote add origin https://xxx.somewhere.com/_git/xxxProjectNamexxx
    git push -u origin --all

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

    I was just having the same problem, and the answer by ngm didn't work; I had to do the opposite. The [remote "origin"] section was already in my .git/config file, however the project code wasn't uploaded to TFS.

    To fix it I just deleted that section from the config file, then restarted Visual Studio and followed the official instructions.

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

    In the Team Explorer window find your repository under Local Git Repositories. Right click on the one you want to change and pick Open Command Prompt. Now type git remote -v and it should show you the remote name and the complete url for it. type git remote remove origin assuming origin is the name of your remote repository. Then git remote add origin [url] replacing [url] with the actual url of your repository.

    Now you should be able to push your master branch into the repository for your team project.

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

    Same problem here, except instead of editing git config files, just delete the entire git repository folder for the project. Reload the project and start over with Source Code action under file. Then add all changes to the project to the local Git. Then "Sync" and it will display the url textbox.

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

    I had the same problem today, I was not understanding why this "Publish to..." menu didn't appear. I found that it's because you have to map one online repository to a local one, no more.

    In your example, it seems Gittyup online is already mapped to Gittyup local, so you have to create a new Git project in the web interface, then you connect to it in VS, and then you can publish your local repository to the online one.

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

    I had this same exact problem. I was able to resolve it by restarting Visual Studio completely, opening Team Explorer, then navigating to my local repo. I opened up my local .sln, then clicked on "Changes", "Commits" and it then had an area where I could Publish the project to a URL. I took that URL such as: https://myapps.visualstudio.com/DefaultCollection/_git/MySolution and then clicked "Publish" (I had to do it twice.) I can now commit to the TFS and view my code online.

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