Create a GitHub Repository with multiple Eclipse Projects
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 GitHubRepository 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:
- Use Eclipse to Clone a GitHub Repository with multiple projects
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:
- If you have the source code of the Java Project(s), and ready to bring to GitHub Repository.
- 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: