DEV Community

Cover image for IntelliJ Idea Integrated with Bitbucket Repository
Sahil Tiwari
Sahil Tiwari

Posted on

IntelliJ Idea Integrated with Bitbucket Repository

By the end of this article, you will be able to create a Bitbucket repository and Integrate it with IntelliJ IDE. We’ll see the first time set up process and latter processes. So let’s dive into it.

What is a Repository?

In software development, a repository is a central file storage location. It is used by version control systems to store multiple versions of files. This may include multiple source code files, as well as other resources used by the program. Branches are used to store new versions of the program.

What is GIT?

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. I have created a git repository and explained step by step in detail in my last post, you can check it out here — link

What is Bitbucket?

Bitbucket belongs to “Code Collaboration and Version Control” category, while Git can be primarily classified under “Version Control System”.
Bitbucket is a Git repository management solution designed for professional teams. It gives you a central place to manage git repositories, collaborate on your source code, and guide you through the development flow. It provides awesome features that include: Access control to restrict access to your source code.

Is Bitbucket free?

Yes! Bitbucket is free for individuals and small teams with up to 5 users, with unlimited public and private repositories. You also get 1 GB file storage for LFS and 50 build minutes to get started with Pipelines. You share build minutes and storage with all users in your workspace.

How to create a Bitbucket Repository?

Create a bitbucket repo. Go to https://bitbucket.org/ and create a repository by clicking on + symbol in the left pane of the Bitbucket home page.
Alt Text

Select the Repository under CREATE options.
Alt Text

Fill out the below details like Workspace, Project name, Repository Name, Access level, Description, Language, and then click on Create Repository.
Alt Text

Voila! You have created a bitbucket repository. Now copy the git clone URL and start putting your local code inside our new repository.
Alt Text

Here I’m assuming that you have your local code which you want to push on bitbucket so that others can also contribute to that code. I have written an article, where I have created the Rest assured framework in Eclipse from scratch and pushed it to GIT. You can copy that same framework if you don’t have a local code handy.
Here is that article:


Here is the repository: https://github.com/sahilTiwariQA/rest_AssuredFramework

In this article, I’m gonna be using IntelliJ for IDE. IntelliJ IDEA is a cross-platform IDE that provides consistent experience on the Windows, macOS, and Linux operating systems. IntelliJ IDEA is available in the following editions: Community Edition is free and open-source, licensed under Apache 2.0.
Eclipse falls short in providing good assistance for code completion despite supporting many plugins. The default code compilation in IntelliJ is much faster and better, especially if you’re a newbie programmer — IntelliJ can help you improve your code.
Open IntelliJ and import your local project from File->Open.
Once you have imported the project in local IDE, let’s enable version control Integration so that we will be able to Push and Pull changes seamlessly in that project.
Go to VCS -> Enable Version Control Integration
Alt Text

Select Git and click OK.
Alt Text

Now again go to VCS, this time around you will be able to see more options. Add your bitbucket repository by going to Git-> Remotes
Alt Text

Click on “+” symbol to add Bitbucket repo URL.
Alt Text

When you paste the URL, make sure to remove “git clone” command from start of the URL so that your URL starts with “https” and ends with “.git” :
Alt Text

Enter your Bitbucket credentials for Authentication.
Alt Text

Click OK to confirm.
Alt Text

Now that Bitbucket is connected it will show you a pop-up in Event Log. Click on View Files.
Alt Text

It will show you the whole project to add to Git. Click on Add.
Alt Text

Once you’ve added the project, let’s Commit and Push the code to Bitbucket. For that go to VCS->Commit. Since you have not committed any changes before it will open Commit window in the left pane. Give commit message and click on Commit.
Now go back to VCS->Git-> Push
Alt Text

Check your commit message and all the files and click on Push.
Alt Text

Go back to your Bitbucket repository and refresh it to see your Pushed changes in your repository.
Alt Text

Well, you have successfully created a bitbucket repository and pushed your local code into it.

All the above steps are a one-time process except to commit and push steps. Once you have connected IntelliJ to your repository (Bitbucket), you can make changes and commit and push directly from IDE itself. To demonstrate this let’s create a new java class and try to commit and push.
Alt Text

On the next step, it will ask for Push confirmation. Click on Push and check Bitbucket to confirm if the changes are pushed to the repository or not.
Alt Text

And there you have it! All files updated as expected.

Top comments (0)