• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

  • Home
  • Test Case Examples
  • Interview Questions
  • Interview Questions Asked
  • Java
  • Java Program
  • Selenium
  • Selenium Programs
  • Manual Testing
  • Difference
  • Tools
  • SQL
  • Contact Us
  • Search
SoftwareTestingo » Tools » GIT » How to Connect Eclipse With GitHub?

How to Connect Eclipse With GitHub?

Last Updated on: August 8, 2022 By Softwaretestingo Editorial Board

What We Are Learn On This Post

  • Connect Eclipse With GitHub
  • Installation and setup
  • How to Push Changes to Remote Repository?
  • How to Commit Files Using Eclipse?

Connect Eclipse With Git: If you’re a programmer, then you know how important version control is. And if you don’t know what Git is, then you need to get on board because it’s about to change your life! Git is a free and open-source distributed version control system that is designed for speed and efficiency. It tracks changes in project files done by multiple developers so that everyone can stay up-to-date on the most recent developments. Eclipse is one of the most popular integrated development environments used by programmers which makes using Git super easy. So if you want to learn how to add your git credentials in Eclipse, read on!

Connect Eclipse With GitHub

In this blog post we are going to learn about:

  • How to Set up and install Eclipse with EGit, and get a GitHub account
  • Clone/fork an existing project from GitHub and import it into Eclipse
  • Commit changes to a file in the GitHub project from Eclipse
Post Type:GIT Tutorial
Published On:www.softwaretestingo.com
Applicable For:Freshers & Experience
Get Updates:Join Our Telegram Group

Installation and setup

If you want to get started with the development of software, you need to have Eclipse and EGit installed on your computer. You will also need a GitHub account so that you can access the code repositories.

Download Eclipse: First You have to download Eclipse from the official website of Eclipse If you have not downloaded it yet.

Install EGit Extension: If you’re using Eclipse, EGit is a plugin that allows you to interface with Git. Version control is becoming increasingly important, Nowadays EGit comes pre-installed with Eclipse downloads. If it is available within Eclipse then no need to follow the below steps.

If the EGit extension is not installed on your Eclipse then you can install it by following the below steps:

Open Eclipse and Click on Help Menu then Click on Install New Software, It Will open the available software dialog box like below.

Available Software
Available Software

Then Click on Add button, after that in the Name text box enter EGit, and in the URL text box enter https://download.eclipse.org/egit/updates/. Then Click Add in the dialog box.

Enter Details
Enter Details

Then It Will Display all the related extensions. There you need to select all the checkboxes and click next.

Select All The Check Boxes
Select All The Check Boxes

After that accept the terms and conditions and Click finish. Once you click finish the EGit install become successfully completed.

Create GitHub Account: During the GitHub blog post, we have already created a Github account. If you don’t have a GitHub account then for creating your GitHub account you can follow our detailed blog post where we have described in detail the GitHub account create process.

Create a repo in your GitHub account: After Creating an account on GitHub, Now you need to create a repository on GitHub. If you are worried about how to create a Git repository then you can follow our detailed blog post on how to create GitHub Repository.

 Import your repository into Eclipse: the Final part is importing the repository to our Github account. So to Import your repository from GitHub you can follow the below steps:

  • Open Eclipse, with EGit, installed
  • In Eclipse, choose File, then Import
  • In the dialogue that opens, choose Git > Projects from Git and click Next
Select Projects From Git
Select Projects From Git

If You have an existed local repository on your local machine then you can go with the existing local repository option. But for now, we are going to use the repository present on GitHub. So for that, you have to choose the Clone URI option.

Choose The Source Of Repository
Choose The Source Of Repository

Click on Clone URI and click Next.

Source git Repository Configuration
Source git Repository Configuration

Here you have to fill in the required information such as URI, Host, Repository Path, Username, and password.

You can get the URI from your Github Repository URL.

You can Get URI Here
You can Get URI Here

In the Host text box, you need to enter “github.com” because our repository is hosted on GitHub.com. and in the repository path, you need to enter the path of the repository.

The Full URL of our repository is looking something like this “https://github.com/softwaretestingo/javaprograms” but we need to mention the username and the repository Name. In This case which is “/softwaretestingo/javaprograms“

Note: When you enter the URI, then automatically it will collect the information of HOST and repository URL:

After that, you have to enter your GitHub username and password for authentication and Select the Store in the secure store checkbox. Then Click Next.

Source git Repository Configuration With Values
The source git Repository Configuration With Values

After Click Next it will connect with the GitHub Remote repository and in Return, it will display all the branches of the mentioned repository. Currently, we have only one branch available so the master branch is displaying.

Select the Branch and Click Next.

Branch Selection
Branch Selection

Here if you want to change the local repository location, then you can configure it here otherwise if you want to proceed with the default location then you can click next.

Local Repository Destination Location
Local Repository Destination Location

You can notice our remote is downloaded to our local machine. And you can click next

Remote Repository is Downloaded
Remote Repository is Downloaded

Currently, in our repository, we don’t have any projects. That’s why we are getting this screen. If you have any projects then those projects will be listed here. Here we don’t have any project so I am going to create a project here. So select the Import Using the New Project wizard and Click on the finish button.

Note: If there is any project on your repository then you will not get the below options.

New Project
New Project

On the Click Finish button, another new pop-up will appear there we select Java Project. If you want to create any other type of project then you can select any other project.

Create Java Project
Create Java Project

Select Java Project and click Next. On Click Next it will ask for your Project Information.

Create A Java Project
Create A Java Project

Click Finish Button. And the Java Project is added to Eclipse.

Eclipse Java Project
Eclipse Java Project

How to Push Changes to Remote Repository?

To Connect with Remote or Share your Project you have to right-click over your project and Choose Team – > Share Project.

Now we need to select the repository from the repository dropdown or you can click on create button to create a repository on the local machine.

Configure Git Repository
Configure Git Repository

Select the Project Checkbox and Click the finish button.

Select the Project Checkbox Dropdown
Select the Project Checkbox Dropdown

After clicking on the Finish button you can notice now the Local project directory is linked with the remote repository.

Project Structure
Project Structure

We have added some files and now before pushing those changes to the remote repository we need to commit those. So to commit You have to follow the below steps.

How to Commit Files Using Eclipse?

Right Click over the project — Team — Click on Commit

The Changes files will be displayed in the unstaged stanged area. You need to move those files from unstaged changes to the staged changes box and after that, before performing the commit operation you have to provide a meaningful commit message.

How to Commit
How to Commit

After that to commit the changes you can click on the commit button or you can click on the commit & push button to push the changes to the remote repository.

Files Added Into Staged Area and Click Commit Button
Files Added Into Staged Area and Click Commit Button

Conclusion:

If you’re working on a project by yourself, the above workflow is all you need to get started with Git version control. However, things become more complex when multiple people are editing the same files at the same time. In these cases, Git’s branching and merging features come in handy. While we won’t be covering those topics in this tutorial, they’re both well integrated into Eclipse and EGit.

In This tutorial, we tried to cover how you can connect with the GitHub repository from the Eclipse IDE. If you still face any issues then you can let us know in the comment section and we will try to help with that.

    Filed Under: GIT

    Reader Interactions

    Comments

    1. Avatar for cyberrb25cyberrb25 says

      January 8, 2023 at 5:49 PM

      I’m having some trouble setting up Git to work on Eclipse. Does it have any trouble because of 2FA? Or does the repository require itself to be public or something?

      Reply

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Primary Sidebar

    Join SoftwareTestingo Telegram Group

    Categories

    Copyright © 2023 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy ~ Testing Careers