Share your Eclipse projects

Connect Eclipse to your Visual Studio account to share your code with your team.

If you don't have a team project that uses Git in your Visual Studio account, create one.

Enable alternate credentials

To use Git with your Visual Studio Online account, enable alternate credentials so that you can sign in from Eclipse.

  1. Go to your team project's home page and open your profile.

    Team project home page, my profile 
  2. Allow alternate credentials for this account.

    Enable alternate credentials link on user profile page 
  3. Set the password for the user name that you use to sign in to Visual Studio Online.

    Alternate credentials enabled in the user profile page 

Clone the repository

  1. Show the Git views.

    Windows menu, show view, other

    You'll use the repositories and staging views here.

    Show view dialog box, Git expanded, Git Resitories and Git Staging selected

    If you don't have the Git views, you can get them by downloading EGit.

     
  2. Use the Git repositories view to clone the Git repository for your team project.

    Clone a Git repository in the Git repositories view  
  3. Specify the URL for your team project (http://[account].visualstudio.com/DefaultCollection/_git/[team project]). Use the alternate credentials that you added for authentication.

    Clone Git repository dialog box with team project URL and alternate credentials provided   
  4. If you just created your team project, the Git repository will be empty. That's OK.

    Branch selection dialog box showing the empty repository 
  5. Specify where you'll keep the cloned repository on your machine.

    Local destination dialog box

    The repository for your team project shows up in the Git repositories view.

    Git Repositories view showing the cloned repository 

Push your code to the remote repository

  1. In the package explorer, share your project.

    In the package explorer, the project's context menu, Team, Share Project 
  2. Make sure you share it to Git.

    Share project dialog box with Git selected

    You'll see how the remote repository is mapped to your working directory.

    Configure Git Repository dialog box 
  3. Add your files to the Git index to stage your changes.

    Get staging view, unsaved changes context menu, add to Git index  
  4. Push the source to the remote repository using the alternate credentials.

    Commit and push button in the Git staging view

    Your code is in your team project's Git repository now. You can open your team project's code page and see the code there.

    Team Project code page with the code pushed to the remote repository 

Q&A

Q:What if the Git views don't show up.

A:You can download EGit to use Git with Eclipse.

Q:Where can I find the URL for my Visual Studio-managed Git repository?

A:It's in the team project home page, in the code explorer.

  1. Open the code explorer on your you team project's home page (https://[account].visualstudio.com/DefaultCollection/[team project]).

    Team project home page, code explorer 
  2. With the repository you want to clone selected, get the URL.

    Team project home page, code explorer, clone icon selected to show the URL

Q:Can I share my code in a team project that uses TFVC?

A:Yes. Use the Team Explorer plug-in for Eclipse.

Try this next