GitHub + Eclipse Integration
Updated: Nov 24, 2018
To import projects from GitHub to Eclipse
1. Once you have created your repository on Github, copy its URL. You should do this by clicking the green "Clone or download" button and copying the address there.
2. Then launch Eclipse in your computer and go to Window >> show view >> other >> git
>> git repositories. You should see a tab called "Git Repositories" open in your Eclipse
eclipse workspace.
3. On the "Git Repositories" tan, click "Clone a Git Repository". Paste the URL in the
provided spot. Copy the directory path, you will need it later. Then click next and then finish once the option pops up.
4. Your project will now have opened in the git repository part of your workspace. You
have now imported the project. However, it is not a java project so you cannot create
classes yet.
5. To do this, go to file >> new >> java project. Enter the project name you want. Uncheck
the "use default path" and paste the directory path you copied before here. Then click
next and finish. The imported project will now appear in your package explorer and
you add files and edit as you like.
To commit/push from Eclipse to Github
1. Go to Window >> show view >> other >> git >> git staging. A window called "Git
Staging" will open. Here the files you changed will appear in "unstaged changes".
2. You can drag and drop the files you want to commit into the "staged changes" portion of the window. It is recommended you commit only .java, README files, and important files, so don't commit git.ignore and such files. Note: in order to move files
from unstaged to staged, you must first save the file.
3. Then enter your commit message in the left commit message box and push either
"commit" or "commit and push" depending on what you want. The commit will appear
in your workspace.
4. To see all of your commits, go to Window >> show view >> other >> team >> history.
This will display all of your commits and you can click on them to see the changes
made in them.
To fetch from Github to a connected, open Eclipse project
1. Right click on the file you want to update or the project name >> team >> fetch or pull.