Git is a version control system to manage files remotely and keep track of all the changes. Similarly, 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.
A Git repository is a virtual storage of your project which allows you to save versions of your code, which you can access when needed.
Here at LinuxAPT, we shall look into how to configure and manage a Bitbucket repo on Debian 11 bullseye server.
Steps to setup Remote Git Repo on Debian 11 bullseye system
1. Perform System Update
To begin, update your system to ensure all existing packages are up-to-date to avoid conflicts with the following command:
$ sudo apt update && sudo apt upgrade -y
2. Install GIT
Git is available in the Debian Bullseye repository, installed using the APT package manager. To do this, use the following command:
$ sudo apt install git -y
Once installed, verify the installation:
$ git --version
3. Register for Bitbucket cloud
Here, we will proceed to connect and configure the Bitbucket cloud. Visit bitbucket.org and get it for free.
4. Create repository in Bitbucket
Now, create a repository in our BitBucket cloud where you will enter the Project name, Repository name, Access level and so on.
5. Connect and Configure Bitbucket
Once a repository is created, we will go to repository settings to connect with BitBucket locally.
6. Clone repository
Now, clone the repository using the clone link which you will find on the top right of the project page.
The git command format to use is given below:
$ git clone https://firstname.lastname@example.org/username/reponame.git
You must update the username and reponame to match with yours.
Now type the following command to list your fetched directory on your system:
7. Create a File and Link with Bitbucket
Now we'll go to our repository folder, create a new file, and push it to the origin which is Bitbucket.
Follow the below steps:
i. Type the following command to change the directory:
ii. Now create a new file using the following command:
$ touch update.md
iii. Next, edit the file in nano with the below command:
$ nano update.md
iv. 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.
How to Update/Upgrade GIT
For updates to GIT, they will be included with your standard system packages as you installed git-core with the APT package manager. You can Use the following command to update and upgrade:
$ sudo apt update && sudo apt upgrade
How to Remove (Uninstall) GIT
For users that no longer want GIT installed or would instead roll back to the default packages present in Ubuntu's repository, first use the following command to remove git:
$ sudo apt autoremove git -y
[Need help in fixing Git Repo issues ? We can help you. ]