Search code examples
githubtfsmigration

Migrate from on premise TFS 2018 to GitHub


We have a on premise Microsoft Visual Studio Team Foundation Server 2018 on a sever in our office. It has been running for over a decade as our source control from Visual Studio with no real issues. We are currently moving all code source control to GitHub and can find no way to migrate from the on site server to GitHub. I have looked at many many suggestions from web searches but I fail when trying to enter the url for the repository as it does not seem to exist. I have tried many combinations to navigate to a web url for any of the projects but not work (when attempting to use git tfs for the migration). Any help would be appreciated

EDIT: Our TFS instance is running on premise. I can access all repositories on our internal network but not from the outside as we are air gapped. When i enter the url to a repo as 'http://:8080/tfs///_versionControl?path=%24%2FECHO%2F' i can only download the code as a zip, there is nowhere to create a local repo. I may be muddying the water with my explanation but i would like to take this repository, and its full check-in history, and push to a new GitHub repository to take advantage of outside teams wanting to work at the same time. We want to move from an in house (and old) TFS to cloud.


Solution

  • From your updated description, you are using the TFVC repo in TFS2018. When you download the repo as zip, it will not contains the history and not show as a valid git repo.

    To meet your requirement, you need to use git tfs tool to migrate the TFVC Repo to Github git repo.

    Here are the steps:

    Step1: Run the script: git tfs clone <TFS URL> $/project/folder (The repo type is tfvc). Then you could clone the project and all history.

    Step2: Run cd repo path to navigate to the local repo path and git checkout -b customBranch to create a temp branch.

    Step3: Run git remote add origin <Git URL> to set the target.

    For example: git remote add origin http://github.com.... (The repo type is git)

    Step4: Run git push --set-upstream origin CustomBranch to push all repos to the temp branch.

    In this case, the migrated git repo will contain all history of the tfvc repo.

    Note: You need to execute the git tfs command on the machine which can connect to the TFS Server.

    For more detailed info, you can refer to this doc: importing a team foundation version control repository