Prerequisites
- An SSH key shared with GitHub
- Access to a GitHub repository with an Eclipse project
Show Eclipse views
In Eclipse, open the Git Repositories and Git Staging views.
- Select
Window -> Show View -> Other
Window menu - Select
Git -> Git Repositories / Git Staging
Show View dialog
Clone GitHub repository
- Open the repository on GitHub.com.
- Under the green Code button, copy the SSH URI. It might be necessary to click the SSH button. The SSH URI begins with
git@github.com:
. GitHub SSH URI - In the Eclipse Git Repositories view, select the Clone button. The Clone button has a green arrow and a tooltip that reads “Clone a Git Repository and add the clone to this view”. Clone button
- Select Clone URI as the Repository Source.
- In the Clone Git Repository dialog, Eclipse usually reads the URI from the clipboard and inserts it into the URI box. If this did not happened automatically, paste the URI into the URI box. All other fields complete automatically. The User is
git
and the Password is blank (since authentication is by SSH). Clone Git Repository dialog - Click Next until the Local Destination step (at the top of the dialog box). If this is the first time this user account on this computer has connected to GitHub via SSH, a couple of messages regarding keys may appear. Selecting the check boxes prevents the messages from appearing again.
- At the Local Destination step, make sure the option Import all existing Eclipse projects after clone finishes is checked. Local Destination step
The repository appears in the Git Repositories view. Repository in Git Repositories view
The project appears in the Package Explorer view. Project in Package Explorer view
Fix missing project in Package Explorer view
If the repository appears in the Git Repositories view but the project does not appear in the Package Explorer view, the Import all existing Eclipse projects after clone finishes checkbox was likely left unchecked.
Import the project from an existing GitHub repository.
- Select
File -> Import
. - Select
Git -> Projects from Git
. - Select Existing local repository.
- Select the repository that was just cloned in the step above.
- Click Next/Finish for the remaining steps.