How can I push my existing Git repository to Team Foundation Service

前端 未结 6 1018
终归单人心
终归单人心 2020-12-01 07:31

Microsoft now has support for Git repositories on their Team Foundation Service. I have an account on Team Foundation Service, and I\'d like to push my existing Git reposito

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 08:02

    All we need do is change the server target url of the existing local solution/repo.

    So:

    1. In the cloud (TFService), create a new project and get it's url.
    2. On your local machine, open the existing solution/repo in Visual Studio and in the Package Management Console (PMC) run the following command

      git remote set-url origin https://new.url.here

    3. Using View>Team Explorer>Unsynched Commits push the existing solution / repo to the new project.

    This will push the local repo, including all previous commits, to the new TFS project in the cloud.

    Git command line FTW.

    All this doing is updating the [url origin] attribute in the config file found in the .git folder, so you could just use notepad if you wanted to open and edit this file. IMHO this command is cleaner because you don't run the risk of accidentally editing some other setting nor do you have to leave VS.

    Note: If the option to Push in step: 3 is disabled then you may have to perform another local commit in order to "dirty" the head of your source tree and thus enable the push command. Tho I'm sure there would be another git command to do this as well.

提交回复
热议问题