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
Step-3: Open Git perspective , Window > Open Perspective > Other > Git
Step-4: Open your repository and copy the GIT URI
Here is a screenshot of Bitbucket 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.
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”
Step-8: When the cloning finishes you will see Git Repository.
Now 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
Step-9: Create a new project.
Step-10: Once the project has been created, you will see the project in the 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
And you are done.
Check you can see the code in the source tab of the repository.