Today we are going to discuss how to configure and manage a Bitbucket repo on Debian 11 server. I am using Debian 11 server edition for this guide, and I’ll make sure that all commands are readily available for all related systems except Fedora. The main reason that you should not implement instructions on a Red Hat systems is to avoid any configuration mistakes and dependency issues.
What are Git and BitBucket exactly?
The simplest answer, for now, is that Git is a version control system to manage files remotely and keep track of all the changes. Unlike Git, BitbBucket is a platform that helps to keep those files on the server. BitBucket has both self-hosted and cloud options, but we are only going to use the cloud version which is freely available for a team of up to 5 users.
I will keep exploring Git and BitBucket separately in future articles. For the latest tips and tricks keep visiting linuxways.net regularly.
First things first
As always we should make sure that the Git is available on your system. I’ll run the following command to make sure that I have the latest stable version of Git on my Debian 11 server.
$ git --version
The command will display your latest available git version. In my case, it is 2.25.1 as shown below:
Connect and Configure Bitbucket
Step 1. Now we will proceed to connect and configure the Bitbucket cloud. Visit bitbucket.org and get it for free.
You will have a similar dashboard as below once signed up successfully:
Step 2: We’ll then create a repository in our BitBucket cloud.
Step 3. Once a repository is created, we will go to repository settings to connect with BitBucket locally.
Step 4. First clone the repository using the clone link which you will find on the top right of the project page.
In our case, the git command will be:
$ git clone https://[email protected]/username/reponame.git
You must update the username and reponame to match with yours.
The whole scenario will go similar to the following:
Now type the following command to list your fetched directory on your system
Step 5. Now we’ll go to our repository folder, create a new file, and push it to the origin which is Bitbucket.
1. Type the following command to change the directory
2. Now create a new file using the following command
$ touch update.md
3. We’ll edit the file in nano as shown below
$ nano update.md
4. Once saved we’ll push our changes to the Bitbucket repository using the following commands.
$ git add *
$ git commit -m “update”
$ git push origin master
These will push all the changes to our Bitbucket repository.
In this tutorial, we learned how to create a repository on Bitbucket, fetch it, modify, and push it locally. We also used some other software like nano editor. There are many more tricks and tips available on LinuxWays for advanced understanding of Git and related Linux software. If you have any questions then submit your questions, and we’ll be happy to help you.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.