Repository Management in Bitbucket

Atlassian Bitbucket

Bitbucket is a Git-based source code repository, which offers both commercial plans and free accounts. They provide Access control to restrict access to your source code. The main difference between Git & Bitbucket is, Bitbucket is a web-based version control while Git is distributed version control. And the steps for creating repositories and uploading files are to be followed.

Step 1: Create new Repository :

Create new Repository

  • Navigate to “ https://bitbucket.org ”, after signing select the ‘ Create ‘ button and Select the ‘ Repository ‘ option.

Repository Name

  • By providing the adequate, “Project name”  & “Repository Name “ 
    Click on “Create Repository” Button.
  • Then your repository will be created.

Step 2 : Add SSH key

Personal Settings

  • Select the Account icon – > Select the “Personal Settings” tab

SSH Keys

  • Click on “SSH key” icon

Add key

  • Select the “Add key” icon and give the public key. 
  • To get the public key go to git bash and enter $ cat ~/.ssh/id_rsa.pub in Linux and windows and for macOS $ pbcopy < ~/.ssh/id_rsa.pub 
  • A public key will be generated in git bash cmd prompt, copy that key completely and paste it over the ‘Key’ field under ‘Add SSH KEY’ window. 
  • After pasting the SSH key, click on the ‘Add key’ button. 
  • If the SSH key is not generated please refer https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ 

Step 3 : Clone the repo to Root folder

Clone the Repository

  • Select the ‘Clone’ Button.

Clone the repository

  • Copy the SSH link, Go to the root folder and clone the repo using Git bash.

gitignore

  • If you setup the steps correctly, you will be able to find the “.gitignore” folder in the corresponding root folder.

Step 4 : Pushing the files into Repository

There are 2 ways to push the files in Repository

Via Git Bash cmd prompt
  • Copy the files needed to be pushed to the root folder.
  • Open the git bash window, and enter ‘ git add . ‘ then all your files will be added.
  • Enter ‘  git commit -m "message" ‘  then files will be committed with the message.
  • Enter ‘ git push‘ and then the files will be pushed to the repository.
Via Git GUI
  • Copy the files needed to be pushed to the root folder.
  • Open the Git GUI

Unstaged changes

  • Then the files you need to be pushed will be under ‘ Unstaged Changes ’, and if you click on the left-top side of each file, these will be moved to the under ‘Staged Changes’, as shown below.

Staged Changes

  • As you can see, the files from the ‘Unstaged Changes’  are now under the ‘Staged Changes’, after giving the Commit message and the field, click on the ‘Commit’ button.

Notification

  • After selecting the ‘Commit’ button, the files will be committed and the notification will be displayed at the bottom of the window.
  • After this step select the ‘ Push ‘ button.

Push the changes

  • Select the master branch, and select the ‘ Push ’ button.

Success Dialog box

  • Then you will see the success dialogue box, and the files will be pushed to your corresponding repository as shown below.

Files pushed to the repo

Conclusion

Bitbucket’s unique customizations and integrations make it easy for your team to deliver quality software. By following the steps mentioned in the article, you can easily create repositories within Bitbucket and utilize them to store and maintain files for your organization. 

Saibalu R