Search code examples
gitmigrationtfvcazure-reposgit-tfs

git-tfs when trying to clone TFVC repo error contacting server


I am trying to move a repo from TFVC hosted by an ex colleague to a new azure devops account (which will use git). From researching, the only possibility I have found to move it with history is to use git-tfs tool in the command line. When I run this:

git tfs clone -u xxxx -p xxxx https://acctname.visualstudio.com/project/_versionControl?path=%24/repo/folder $/https://dev.azure.com/newaccount/newproject/_git/newrepo .

I get a pop up to log in to the microsoft account and after logging in successfully I get this:

Please contact your administrator. There was an error contacting the server.
Technical information (for administrator):
  HTTP code 200: OK

I am at my wits end with this. If anyone has a better way of handling the whole move, I'd be happy to hear it as well.


Solution

  • Calling git tfs clone will try to create a local copy of the TFVC repository on your friends original Azure DevOps instance. It does not mirror the Repository from one server to another in a single command. Once that local copy has been created you can add the new account as a remote and then push the changes over to the new account.

    git tfs clone https://acctname.visualstudio.com/ $/project
    git remote add target https://dev.azure.com/newaccount/newproject/_git/newrepo
    git push -u target main
    // Optionally push other branches too.
    

    But there may be a simpler way to do this. In Azure DevOps (and also his all account) there is an import option on the new blank repository within the source account. In the Repository drop-down, pick 'import repository' and point it to your TFVC main branch. This will convert up to 180 days of history and creates a git repo for you in the source account. If you want more than 180 days of history, githtfs is the only way.

    You can then use the same import repository option on the new account to transfer the git repo from the old account straight into the new one.

    If you pass in the source account in combination with a Personal Access Token with at least 'Code (Read)' permission, you can have Azure DevOps perform the migration for you.

    See: