Using Github in Eclipse Addendum

Create a Repository in the Project Directory

  1. In the Package Explorer right click on the project name.
  2. Select Team->Share Project. The Configure Git Repository dialog is displayed.
  3. Check the box by Use or create repository in parent folder of project.
  4. In the selection area, click on the project folder. The name is duplicated in the box below.
  5. Click the Create Repository button.
  6. Click Finish. The repository shows in the list of the local repositories view.
  7. In the repositories view, select the repository just created. The unstaged project files are displayed in the Unstaged Changes view.

Configure Push Operation

  1. In repository view, right-click on the Remotes node.
  2. In the pop-up dialog window, click Create Remote. The New Remote dialog window is displayed.
  3. Accept the origin default value. Click OK.
  4. In the next dialog window, click the Change button.
  5. Enter the URL of the remote github location. The other values should be filled automatically.
  6. Click Finish.
  7. Click Save.

Merge Local and Remote Repositories

  1. In the Remotes node under origin, look for the green arrow pointing down, this is the Fetch arrow. Right click on the Fetch entry and select Configure Fetch in the popup window. You should see the URI, assure that it points to the remote repository.
  2. Look in the Ref mappings section of the popup. It might be empty. You must indicate which remote references you want to fetch. Click Add.
  3. Type in the branch name you need to fetch from the remote repository, usually master.
  4. Continue through the wizard.  Ignore the warning Remote tracking branch ‘refs/remotes/origin/master’ not found in local repository.
  5. Click Finish.
  6. In the last popup window, click Save and Fetch.  This will fetch the remote reference
  7. Click OK.

Look in the Branches folder of your local repository. You should now see the remote branch in the Remote Tracking folder. You should see something similar to the following:

  1. You should have a list of un-staged files. Stage all the project files but one (we need a second staging later to push all the committed files).
  2. Enter a comment such as “first commit”.
  3. Click the Commit. This puts the project under configuration control.  in the Local folder, you should see something similar to the following:
  4. Expand the Local folder of Branches, right click on the node named master.
  5. Select Merge. The Merge wizard is displayed.
  6. In the Merge wizard, under Remote Tracking folder, select the remote branch named origin/master.
  7. Click Merge.
  8. Follow the merge wizard steps.
  9. Now stage the remaining file. Add comment “first commit”.
  10. Click the Commit and Push
  11. Go through the Wizard steps.
  12. Click the Finish.
  13. Wait for the push operation to be configured and then click the OK button.


Leave a Reply

Your email address will not be published. Required fields are marked *