You are currently viewing Building a Trading Platform – Part 4:  Using GitHub with Eclipse

Building a Trading Platform – Part 4: Using GitHub with Eclipse

In the last article, we generated a Spring Boot application that is now running and has successfully established a connection to our database. Now it is time to protect our progress by adding our Spring Boot application to GitHub using Eclipse. Luckily, with Eclipse this is very easy!

First, we need to create a new repository in our GitHub account. The repository name will be tradingvessel-core, based on our project group and artifact. The repository will be private in our case, but for the integration it does not matter, as long as you pull the repository using the same user in Eclipse as the one you used to create the repository on GitHub. One the repository is created, copy the repository URL and switch back to Eclipse.

To see any Git Repositories that have been integrated in Eclipse, we can go to “Window Show View Other → Git → Git Repositories”.

The new window (in Eclipse called “View”), will typically appear among the bottom windows and look similar to this:

To add our online repository to the list of repositories in Eclipse, we select the “Git Repositories” View and paste the link. Eclipse will open a prompt, asking for our GitHub credentials and giving us the option to save our credentials for similar future operations. Once we entered our credentials, we click “next” twice and “finish”.

Our Git Repositories View should now look like this:

Time to add our project to the remote repository. To achieve that: Right-click on the project root folder Team Share Project … . The added remote repository should now be available in the repository dropdown. Select the correct repository and click on “Finish”.

The “Package Explorer” view should now show the name of the remote git repository branch name.

We can now execute our first, initial commit. To do that, we select the root folder of the project and press “CTRL + #” (or “CTRL + SHIFT + 3” for US keyboard layouts). This will cause Eclipse to show the “Git Staging” view. This will initially show all files under “Unstaged Changes”. We can select any files in that section of the view and press “CTRL + A” to select all of them. Then we drag and drop them into the “Staged Changes” section and add a commit message, like “Initial Commit”. Since this is the first commit, the commit message can be simple. In the future of course, it should be meaningful enough for other developers to understand what is happening. Next we click on Commit and Push to open the next prompt.

At this point, Eclipse should already be able to automatically determine and set the correct remote branch:

Initially, Eclipse will commit the project to the “master” branch, which will be created upon successful commit:

Upon success, Eclipse will confirm the push to the remote branch in a window similar to this:

We can manually confirm the successful push by visiting the URL of our repository, under, which should now look something like this:

Let us summarise what we achieved:

  1. Create a GitHub repository on GitHub
  2. Add the remote repository to Eclipse, where the IDE created a local copy of the repository
  3. Connect the project in our workspace with the remote repository
  4. Stage our project files to commit and push them to our remote branch

That is already it. We now have a source version tool that is fully integrated in Eclipse.

Leave a Reply