Migrate a TFS repository to a VSTS Git repository

February 17, 2016, (updated on February 25, 2016), Software Development

To migrate a TFS repository to a Visual Studio Team Services Git repository, just perform the following steps:

  1. Install the Git command line tools so that the tools are registered in the Windows command prompt
  2. Install the Windows package manager Chocolatey
  3. Install the command line tool git-tfs with Chocolatey:

    choco install gittfs
    
  4. Create a local directory for the new Git repository and set the command line’s currect directory to this directory

  5. Clone the TFS repository into the local directory:

    git tfs clone https://[TFSSERVER] $/[REPOSITORYPATH] . --ignore-branches --debug
    
  6. Optionally add .gitignore and .gitattributes files to your Git repository

  7. Add the VSO Git server as origin:

    git remote add origin https://[PROJECTNAME].visualstudio.com/DefaultCollection/[COLLECTIONNAME]/_git/[REPOSITORYNAME]
    
  8. Push all changes to the remote server:

    git push -u origin master
    
Tweet about this on TwitterShare on FacebookEmail this to someoneShare on TumblrShare on LinkedIn

Tags: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax