19

I have a remote repository on visualstudio.com (a free account) but its on tfs, and I want to move it to git for visualstudio.com

Has anyone tried this yet?

I found this tutorial:

http://gitstack.com/how-to-migrate-from-tfs-to-git/

But in that there is a command git tfs clone http://tfs:8080/tfs/DefaultCollection $/TeamProject/git_folder which copies from tfs to another folder and converts to git.

How can I create a separate (git) folder in remote visualstudio.com server?

Also when doing this will it ask for my Windows Live id to authenticate or is there any command-line command?

Umair
  • 4,864
  • 3
  • 28
  • 47

2 Answers2

16

Got it working, correct command is to use https without project name after DefaultCollection here for example:

git-tfs clone --username=mumair85 --password=xxxx https://mumair85.visualstudio.com/DefaultCollection $/uGen
Umair
  • 4,864
  • 3
  • 28
  • 47
  • And remember to use `--with-branches` if you have TFS branches in order to clone everything. – friederbluemle May 04 '14 at 01:45
  • 1
    Be careful with --with-branches, if you have binaries checked in and many branches. It could take weeks to clone everything, and Git-TFS doesn't have a way to set up LFS before cloning. – Matt Kerr Apr 04 '17 at 23:42
12

If you use the Git Credential Manager for Windows (which is included in recent versions of Git for Windows), then it will prompt you to login to Visual Studio Team Services and set up authentication for you. You do not need to manually set up alternate authentication tokens.

To use git (without the Git Credential Manager), git-tfs or git-tf, you'll need to set up Alternate Credentials for your Team Foundation Service account:

  1. Click on your name in the upper right of any TFS web page
  2. Select the "Credentials" tab
  3. Select "Enable Alternate Credentials"
  4. Enter a new username and password combination

You can then use this username/password combination for authentication from command-line applications.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • I have that enabled already and tried with the following command by both primary and secondary usernames and am using this command for git-tfs: 'git-tfs clone --username=mumair85 --password=xxxx http://mumair85.visualstudio.com/DefaultCollection/uGen $/u Gen' where DefaultCollection/uGen is the project i want to clone to/uGen directory. It gives me this error: TF31002: Unable to connect to this Team F S – Umair Oct 23 '13 at 19:45
  • Ok got it working, correct command is to use https without project name after DefaultCollection: 'git-tfs clone --username=mumair85 --password=xxxx https :// mumair85.visualstudio.com/DefaultCollection $/uGen' – Umair Oct 23 '13 at 20:33
  • Is all history for checkins etc also migrated to GIT? – dotnethaggis May 12 '14 at 08:56
  • just for the record I didn't need to do anything with credentials, I'd already connected to tfs with visual studio, when I ran `git tfs clone` without any extra credentials it just worked – Tim Abell Nov 13 '15 at 13:03
  • @TimAbell If you're using on-premises Team Foundation Server, then `git-tf` and `git-tfs` should be able to use your domain credentials. (`git` itself can do so if you have enabled Kerberos authentication on the server.) – Edward Thomson Nov 13 '15 at 13:54
  • this was visual studio online - i.e. hosted on a subdomain of https://www.visualstudio.com/ – Tim Abell Nov 13 '15 at 16:11
  • Here's a good tuorial: https://chriskirby.net/blog/migrate-an-existing-project-from-tfs-to-github-with-changeset-history-intact – Serj Sagan Feb 18 '17 at 11:50
  • 1
    Alternate credentials are no longer needed if you are using a build of Git for Windows with Git Credential Manager installed. It will prompt you to auth to VSTS by a UI pop, or use cached credentials. – Matt Kerr Apr 04 '17 at 23:41