Create a GitHub Repository with multiple Eclipse Projects

View more Tutorials:

1- The objective of the article

Possibly when working with Eclipse, you are familiar with a GitHub Repository created corresponding to an Eclipse Project:
In this article, I'm going to guide you how to create a GitHub Repository containing multiple Java Projects. This is the way to create a GitHub Repository containing many other projects written on Eclipse, such as C/C++, Python, etc.
Related articles:
  • TODO Link!

2- Creating a GitHub Repository with multiple Projects

First, create an empty Repository on GitHub.
Next, on Eclipse, select:
  • Window > Show View > Other ...
Then search for a View named "Git Repositories", and click on "Open":
On the "Git Repositories" window opened, click on "Clone a Git repository":
Enter your username/password and the address of the GitHub Repository, then click Next.
Select a directory to be used as a Local Repository. Note that this directory must be different from the "Eclipse Workspace" directory you are currently working on.
  • C:\git\my-repo-1
After the complete "Clone", you will get an empty Local Repository, which does not contain any projects.
At this point, there are two possibilities:
  1. If you have the source code of the Java Project(s), and ready to bring to GitHub Repository.
  2. If you do not have Java Project(s), you need to create them before posting on GitHub Repository.

3- Case 1: Java Projects are available

If you already have Java Project(s), copy and paste them into "Local Repository":
Then on Eclipse, import these projects from "Local Repository" into your "Eclipse Workspace".
  • File > Import...
    • General > Existing Projects into Workspace
Select "Local Repository" as the root directory to import projects.
After the import is completed, you will see the projects shown on Eclipse:
Note: When you open the "Eclipse Workspace" folder, you will not see any projects. The source code of the projects is still in the "Local Repository" folder; therefore, any changes made to the source code of the projects will be stored in the Local Repository.
On the "Git Repositories" window, right click on a Repository and select "Commit" to push the changes of the project source code to GitHub Repository.
And you will see the projects displayed on GitHub:

4- Case 2: Java Projects are not available

If you do not have any Java Project(s), you need to create them. However, you should store them at "Local Repository" instead of "Eclipse Workspace" where you are working on. Later, you can follow the instructions as mentioned in the first case.

View more Tutorials:

Maybe you are interested

These are online courses outside the o7planning website that we introduced, which may include free or discounted courses.