6 Steps To Setup Project in Eclipse with GitHub Integration: Step-by-Step Guide

Introduction

Learn how to setup project in Eclipse with GitHub for version control. Follow our step-by-step guide to create a branch, commit code, and start working on your created brach with ease

In this post, you will see how to setup a project in Eclipse and push it to GitHub, step-by-step. By the end of the setup, you’ll have a branch called testdevelopment where you can start working.

But before we go ahead, let’s understand an important concept “Stage“. This word had troubled me so much when I started learning GitHub and I wanted to explain it in case you needed it as well.

When you start working on Git, you will see this word every time you want to push your code to the github repository. So what does it mean ?

To understand this, we go back to basic english, search on google – “Staging area”

It says that, Staging area is “a stopping place or assembly point en route to a destination“. Stage, is just the same for files en route to Github cloud repo. When you want to push a code to GitHub repo, it doesn’t go there directly. Instead, you first, stage the files, then commit them to local repo, then push them. More on this later.

Staging area definition on Google - Setup project in Eclipse with Github

Since this blog primarily focuses on selenium and other test automation tools, so here we are showcasing how to commit and push a selenium project for your reference. Although, the steps will work for any kind of projects in Eclipse. You can setup any kind of project in eclipse with GitHub by following the same steps.

Steps to Setup Project in eclipse with github

1. Install Prerequisites:

  • Java: Ensure you have Java Development Kit (JDK) installed. If not, download it here.
  • Eclipse: Download Eclipse IDE for Java Developers here.
  • Git: Download and install Git from here.
  • GitHub Account: Make sure you have a GitHub account. If not, sign up here.

2. Create a New Selenium Project in Eclipse:

  • Open Eclipse.
  • Go to File > New > Java Project.
  • Name the project (e.g., SeleniumAutomation) and click Finish.

3. Add Selenium Dependencies:

  • Right-click your project, go to Build Path > Configure Build Path.
  • Under Libraries, add external JAR files for Selenium WebDriver by downloading from here.
  • Add JARs to the project build path.

4. Initialize Git in Eclipse:

  • Right-click the project, go to Team > Share Project.
  • Select Git and click Create to initialize a local Git repository.
  • In Git Staging, add all files and commit them with a meaningful message (e.g., “Initial Commit”).

5. Push Project to GitHub:

  • Create a repository on GitHub (don’t initialize it with a README).
  • Copy the repository URL.
  • In Eclipse, go to the Git Repositories view, right-click your repository, and select Remote > Push.
  • Add the URL you copied and push to the remote repository.

6. Create and Switch to the testdevelopment Branch:

  • In Eclipse, right-click the project, go to Team > Switch To > New Branch.
  • Name the branch testdevelopment and switch to it.
  • Start coding in the testdevelopment branch.

We have successfully setup project in eclipse with GitHub. Now we have a working connection between the project in eclipse and the GitHub. Let’s move to the next blog Most important tasks in Git using Eclipse to understand how to perform the basic activities.


Discover more from automationscript

Subscribe to get the latest posts sent to your email.

Related Posts