A tutorial on how to use Eclipse with Github.
Go to file
2017-06-12 22:27:16 +02:00
img Added files 2017-06-11 22:31:47 +02:00
README.md Corrected README.md 2017-06-12 22:27:16 +02:00

How to use Eclipse with Github

This is a tutorial on how to use Eclipse with Github.

Requirements

The latest version of Eclipse can be downloaded from here and of course a Github-Account is needed.

First Step: Install EGit in Eclipse

For uploading code from eclipse, the egit-plugin is needed.

  • In Eclipse, go to Help/Install new Software...
  • Paste http://download.eclipse.org/egit/updates in Work with: and click Add
  • Select all of the options and click Next
  • Accept all of the license agreements and finish the installation. Install-window

Create a public DSA-Key in Eclipse

For the authentification with Github, it is neccessary to create a secure key which is known by the local Eclipse-installation and the Github-service.

  • In Eclipse, go to Preferences/General/Network Connections/SSH2
  • Select Key Management
  • Click on Generate DSA Key... Create a DSA-key
  • At the bottom of the window, type in a secret passphrase
  • Click on Save Private Key... and save the file at a well known location.

Register your DSA-Key with Github

  • Open your previous generated file with a text-editor (e.g. Notepad or SublimeText) and copy the whole text to your clipboard (STRG+C/CMD+C)
  • On the Github-page go to your Settings/SSH and GPG keys
  • Click on New SSH key
  • Select a title of your choice and paste the previous copied text from your clipboard into the Key-field (STRG+V/CMD+V)
  • Click on Add SSH key Add the DSA-key

Create a new Repository on Github

  • On Github click on New repository and give the new repository a name
  • Do NOT select the option Initialize this repository with a README
  • Click on Create repository Create a new Repository on Github

Import the Github Repository in Eclipse

  • In Eclipse, go to Window/Show View/Other...

  • Select Git/Git Repositories

  • A new view should appear

  • Click on Clone a Git repository

  • Paste your Repository-URL from Github in the URL-field (be sure to copy the ssh-URL from the Repository page on Github with something like git@github.com at the beginnig) Copy the Link of the Repository

  • Select ssh as Protocol

  • Click Next (there is no authentification needed) Clone Git Repository

  • Click Next again

  • Click Finish

  • When you close the message of the git repository from github, you should define a repository location (e.g. in your home-folder on your system) if Eclipse prompts you to do so

  • You should now have a GIT-view of your repositories (probably just one) GIT-repo view

You have to link your Eclipse-Projects with your Github-Repository to push data to Github.

  • Right click on your project Team/Share Project...
  • Select your repository and click Finish Configure Git Repository

Upload source-files to Github

  • Click on your repository (in the repository-view)

  • Drag all entries from the field Unstaged Changes(n) to the filed Staged Changes(m)

  • Write a nice Commit Message like This is my first commit

  • Click Commit and Push... Commit and Push...

  • Click Next Push Branch master 1

  • Click Finish Push Branch master 2

  • Eclipse prompts you with a message that the data is pushed

  • Click OK Push completed

The end

The upload of your project to Github is finished. You can now open the repository on Github and check your source-files. Your source-files on Github

References

Max Rohde - Eclipse and Github Tutorial
Git with Eclipse (EGit) Tutorial
Getting Started with Git, EGit, Eclipse, and GitHub
git push rejected (on stackoverflow)
A Short Tutorial on Eclipse/EGit/GitHub
Using the EGit Eclipse Plugin with GitHub