Cloning Git Repository in Eclipse

Cloning Git Repository in Eclipse is very easy. You can add any Git repository in Eclipse.

In this post, we will make a clone of existing Bitbucket repository in Eclipse Juno.
 
Follow the below steps:
Assuming that you have created a repository on Bitbucket

Step-1: Open Eclipse and check if your eclipse has the Git perspective or not
If not it does not have the Git perspective then follow step 2 else you can directly go to step 3

Step-2: Go to Help > Eclipse Marketplace
Type Git in Find field and install EGit
Marketplace

Step-3: Open Git perspective , Window > Open Perspective > Other > Git
Git

Step-4: Open your repository and copy the GIT URI
Here is a screenshot of Bitbucket repo
Git Repo

Step-5: Click on “Clone a Git repository”
Now give the in copied URI in the URI field, other fields automatically gets filled.
Now give the password and click Next.
Clone Git Repo in eclipse

Step-6: Branch Selection
The Repository is empty so no branch is displayed. Here, again click Next

Step-7: Local Destination
Here give the Directory where you want to clone the repository
I have given the path of my “eclipse workspace/repo name” or “D:\PROGRAMMING\Eclipse\clone-git”
local destination

Step-8: When the cloning finishes you will see Git Repository.
Now import project
Import Project

Now you can Import existing project or you can Use the New Project Wizard
Here we will create a new project using New Project Wizard and push it to the repository
Import

Step-9: Create a new project.
New Project

Step-10: Once the project has been created, you will see the project in the Explorer
Project Explorer

Create classes and code as you do.
and to push your code to the repository

Step-11: Right click on the project > Team > Commit
Select all the files that you want to commit and give the commit message. Then Press Commit and Push
commit

And you are done.

Check you can see the code in the source tab of the repository.
git source

Github vs Bitbucket

Bitbucket

Bitbucket is similar to Github, a revision control systems that use either the Mercurial or Git.

Github vs Bitbucket
src

Following are the features that Bitbucket provide with all the plan
1. Unlimited private repos
2. Dedicated support
3. Code reviews
4. Custom domains
5. JIRA integration
6. REST API

Bitbucket has an advantage over Github as it offers free accounts with an unlimited number of private repositories. These private repo can have up to five users in the case of free accounts and if you invite 3 users to join Bitbucket then you can add 3 more users which make the total of 8. By this Bitbucket gains an advantage over Github.

If you are a team of 8 people or less developing a project and want to make use of some private online repository, then, Bitbucket suits you.
And if team size increases then you can go for different plans. See list of plans

Git Clients:
You can download GIT client and use GIT Bash or Git GUI to perform GIT operations.

Alternative, you can use Atlassian SourceTree which is a free Git and Mercurial client for Windows.