Prerequisites

Show Eclipse views

In Eclipse, open the Git Repositories and Git Staging views.

  1. Select Window -> Show View -> Other Window menu
  2. Select Git -> Git Repositories / Git Staging Show View dialog

Clone GitHub repository

  1. Open the repository on GitHub.com.
  2. Under the Quick setup section, copy the SSH URI. It might be necessary to click the SSH button. The SSH URI begins with git@github.com:. GitHub SSH URI
  3. 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
  4. 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
  5. Click through the remaining screens in the dialog. 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 prevent the messages from appearing again.

The repository appears in the Git Repositories view. Repository in Git Repositories view

Share project

  1. In the Eclipse Package Explorer, right click on the project. Choose Team -> Share Project. Share Project option
  2. In the Share Project dialog, select the repository cloned earlier. Ensure that the “Use or create repository in parent folder of project” box is NOT checked. Share Project dialog

The files from the project are listed in the Git Staging view under Unstaged Changes. It might be necessary to click on the repository in the Git Repositories view. Files in Unstaged Changes

Commit and push files

  1. In the Git Staging view, click the button with 2 green plus signs (tooltip: Add all files including not seleted ones to the index). Add all files The files move to Staged Changes.
  2. Enter a commit message (typically “initial commit”). Click the Commit and Push button. Commit and Push

The push result shows a new branch. New branch

The project files are visible on GitHub.com. (Refresh the page with the URI.) Project on GitHub

Eclipse project GitHub share video

The 2 links below are to the same video of an Eclipse project shared with GitHub. The YouTube version might show ads (YouTube’s, not mine). The Google Drive version should not show ads.

Comments

Comment on Push Eclipse project to GitHub