Gene De Lisa
Gene De Lisa

Reputation: 3838

Importing an existing maven project with a .git subdir

I have a maven project. I've been using the command line to perform git operations. (I ran git init inside the project so there is a .git subdir in it)

I push it to a bare repository from which I sync via various computers.

One project, one repository; just like thousands of repos on github.

I decided to try egit to manage git from Eclipse even though the command line works just fine.

Ok, right click on the maven project, Team->Share Project, Choose Git, next.

I don't want to create or use a repository in the parent folder - or create one; it already is a repository.

Import Git project barfs on bare repositories, so I can't just "go to the source".

What is the simplest way to import an existing git project?

(I guess, cd to a working dir, clone the bare repo, add that to eclipse as a repo, then import from there - but make certain your run mvn eclipse:eclipse first since git's import isn't as kind and the maven project import.)

Upvotes: 0

Views: 1205

Answers (1)

eGit is not intended to work with bare repositories but to make Eclipse aware of the fact that the various files in the workspace have a VCS behind them and to reimplement enough of the git functionality in pure Java for this to work without a native client.

Therefore clone your repository, and work with the clone. I have found that these steps work well with m2e.

  • clone the repository
  • File -> Import -> Existing Maven projects
  • After the import finishes and the dependencies downloaded, use right-click Team -> Share on all projects, choose Git, and check the topmost checkbox so it looks for .git.

Upvotes: 3

Related Questions