Let’s quickly Configure android studio with bit-bucket Git so it becomes really very easy to make a change and commit it on the bit-bucket. Bit-bucket is mostly used for code and code Review.
- Through Bit-bucket’s second commit we can update our affected files on the repository and if in some cases our projects are deleted or corrupted then we can pull our data through the bit-bucket repository.
- The bit-bucket server is the combination of a Git server and web Interface product. Bit-bucket is similar to GitHub which primarily uses Git.
- Bitbucket has traditionally marketed its services to professional developers with private proprietary software code, especially since being acquired by Atlassian in 2010. Bitbucket has reached 6 million developers and 1 million teams on its platform.
Till date, GitHub and Bitbucket are the two best Known code Repositories. If you’re a developer you’re almost certainly aware of them.
Why Do I Need Code Repository Like Bitbucket or Github?
The main reason to use bitbucket or Github is the source control, that is if you are working on the project with your team members and updating code, then it becomes a crucial task to roll back changes and make the repository available to team members again.
So its time to get Organised and work efficiently!!!
What is GitHub?
Github is the most popular version control out there, with some 57 million code repositories on file. It is loved by the open-source community – as public repositories are free. Free Github accounts are commonly used to host open-source projects.
- It is available for Mac and Windows and Android through an app.
- Bitbucket supports Git and Mercurial VCS.
- It supports external authentication with GitHub, Facebook, Twitter, and Google.
Important Features Include…
- Pull Request and Code Reviews.
- Branch Comparision and Commit history.
- Unlimited Private repositories for free(for up to five members).
How Bitbucket is better than GitHub?
- Bitbucket is more flexible then GitHub.
- It gives you unlimited private repositories.
- Bitbucket has better pricing for private work.
From this, if we want an alternative to Github, Bitbucket is the best.
Now the question comes that how to use Bitbucket. Well, it’s pretty simple to start working with Bitbucket. In this article, we are going to Configure Android Studio with Bitbucket Git.
Lets Start Configure Android Studio with Bit-bucket
First Download the Git setup and install, set environment variables in system variables in the path
Setting Up the Bitbucket Repository
First, you need to create a Bitbucket account. Once you have logged in you can select new repository on the side column by clicking on the “+” button.
Now after that click on Repository
Then in that add the Repository Name and in “Include a README?” choose “NO“.
Now open your Command Prompt and type (write your Bitbucket email ) :
git config --global user.email "email@example.com"
and after that write this (write your Bitbucket username):
git config --global user.name "Your Name"
Now the Configuration is Completed…
- check Java is installed or not. If not then you can learn how to Install it here.
- Android Studio installed on your System(Windows or Mac). You can learn how to Install it here.
- A real-time android device (Smartphone or Tablet) configured with Android Studio.
Creating a new Project
- Open Android Studio and create new project enter your “project name”.
- Click next and choose “Blank Activity”.
- Click on finish.
Now in Android Studio Click on the VCS and select “Enable Version Control Integration” and in that select git as shown in the below screenshot.
Then a popup will come with the heading “Add Files To Github” press “Add”
Now open Terminal in android studio and add the following Command
The result will come as shown in the above screenshot.
Then write next command
git checkout -b master
the result is shown in the above screenshot
Then select your project from the project panel and right-click on it.
Then in it click on Git option and choose “ADD”
Now again in android studio terminal write below command
git commit -am "first commit"
the result should appear as shown in the above screenshot
Now Add Origin that will be in your bitbucket where you have created a repository.
copy the link from bitbucket repository and paste it in the android terminal.
Now add command in android studio terminal.
git push -u origin master
For the first time, it will ask for bitbucket password.
After entering the password the output would come like this
Now Refresh your bitbucket repository page and all the files will be present there.
Now if you commit some change in the code that you have placed on the bitbucket and then if you want to update your files then you have to do the following task:
1.) press CTRL+K and add message and press on Commit.
2.) After that Press CTRL+SHIFT+K and Push this commit in git.
To check whether the changes are committed or not go to Bitbucket Repository and refresh the page.
- In this article, we learned Configure Android Studio with Bit-bucket Git how to add our project in Bitbucket and commit changes and re-add in bitbucket.
- So in this way, bitbucket can serve a very good role when we want our data back or want our data in the first commit form and the most important thing is it is all free of cost so you can store as many code or projects as you want.
- Therefore this brings us to an end of the Bitbucket configuration and commits changes.
- If you like this type of unique articles do checkout at Android Crown.
If any query about it then please drop a comment in the below section.