Since we moved to Git at work for version control, I’ve had a few occasions in which I had an existing Eclipse project in my IDE that I wanted to connect with a Git repository.
The process is, I feel a bit convoluted, but it sort of made sense after I did it once.
First, I had to see the Git Repositories view. So I needed to add it. I’m on a Mac, so I went to the Window menu, selected Other and typed git in the filter box and selected Git Repositories, clicked Ok.
As an aside, if you’re looking at the Git Repositories, and you don’t see your Git repo in the list, you can add it. Just click on the Git button that has the green plus-sign. When you mouse over it, it says, “Add an existing local Git Repository to this View.”
That’s if you have a local Git repo to add, you can also clone a Git repo as well. However you get your Git repo in that view should work.
Now comes the slightly confusing part. To link up an existing Eclipse project with one of my Git repos, I did this. Right-clicked on the Eclipse project, went to Team, then Share Project, selected Git, clicked Next. Then I got a screen where I could select my Git repository.
Now that it’s all linked up, I was ready to get back to work.
For this how-to instructional to work, I’m obviously assuming you have Team and Egit installed in your Eclipse environment. How do you do that? I bet Google knows.