Configure Eclipse to use Team Foundation Service with Git

This is the second post in how to setup TFS and Eclipse to use git. Before you continue here make sure you’ve setup TFS properly as described here. I also assume here that you’ve already installed egit as a plugin in Eclipse.

  1. Create a new local project in Eclipse (File / New / Local PHP Project or something similar)
  2. Right-click the newly created project and select Team / Share project
  3. Select Git in the window opening up
  4. If you don’t have any repository to use then click on Create to create a new oneCreate a new local git repository
  5. Mark some file(s) to be included by the repository (Right-click a file/folder and select Team / Add to index) and make an initial Commit to the local repository to see that everything is working. This can be done by clicking Ctrl + # or by opening the Git Staging window.Initial commit
  6. Open the Git Repository overview. If you don’t have it available then click on Window / Show view / Other and select Get Repositories under the Git section.Viewing Git Repository window

  7. In the Git Repository overview select your newly created repository and right click on the Remotes folder (which should be empty if it’s a new repository).
  8. Select Create Remote and then select Configure Push.
  9. In the next window that shows up click on Change next to the empty read-only URI box.
  10. Paste in the URI given from TFS when setting up the TFS Git repository (see previous post), add username and password and click Finish.Settings for Git repository in TFS
  11. Now when the URI is set you can click on Save and Push to push your initial Commit to the TFS server.URI is configured
  12. The result is presented in a status box.Status from Commit and Push
  13. If you go back to the TFS page and look under the Code section you’ll find the new code you’ve just pushed from Eclipse.
    Code uploaded from Eclipse to TFS