Reputation: 257
I installed Eclipse Mars enabled the Git perspective and imported a repository. It looks fine, but Eclipse is not behaving normal I can't create new files and search is not finding anything outside the file I'm in. What is the proper way to import repositories/projects from GitHub, Bitbucket and other Git Hosts?
Upvotes: 3
Views: 62769
Reputation: 257
Prerequisites GitHub/Bitbucket:
Get an GitHub/Bitbucket account.
Prerequisites on your computer:
Setup the git project in Eclipse
Open perspective "Resource"
Import your GitHub/Bitbucket branch
Under Authentication fill in your GitHub/Bitbucket user and password and press "Next"
Wizard (Branch Selection): Only check your branch, deselect all others and press "Next"
Wizard (Local Destination): Choose a folder where you like to keep your git project, don't put it in your workspace folder and press "Next".
Wizard (Select a wizard to use for importing projects): Select "Import as general project" and press "Next"
Wizard (Import projects): Press "Finish"
The project should now be visible in the "Project Explorer"
Create the ".gitignore" file
This is importent or your code will be mixed with Eclipse files
In "Project Explorer" right click your project folder an then New / File enter ".gitignore" at the "File Name" prompt and press "Finish"
Paste the following in to the file.
# eclipse specific git ignore
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
Finally keep your Eclipse project in sync with GitHub/Bitbucket
Menu: Window / Perspective / Open Perspective / Other and choose "Git"
In the "Git Perspective" drag files from "Unstaged Changes" to "Staged Changes" Enter a "Commit Message" describing your code changes and finally press "Commit and Push"
Upvotes: 3
Reputation: 4034
First you need to clone the (git) repository in Eclipse.
Steps to clone git repo in Eclipse
TIP: The field uri can not be edited. Use the other field, like Host, repository Path, etc to correct the url if required.
/home/<user>/git
)TIP: Make sure that you do NOT clone the git repository inside the Eclipse workspace directory!
After successful cloning of the git repository, the project(s) in the git repository can be imported into Eclipse as (Eclipse) projects.
Import project in Eclipse
Open the Eclipse perspective Java
Maven Project
This will import Maven project(s) (based on pom.xml
file(s)) as Eclipse project(s)
/home/<user>/git
)pom.xml
files.Eclipse
In case the git projects do contain the typical Eclipse configuration files / directory (like: .project
, .classpath
, .settings
), then they can be imported as Standard Eclipse projects
/home/<user>/git
)Upvotes: 10