Categories: LinuxShell

How to Configure and Manage a Remote Git Repo on Linux

Today we are going to discuss how to configure and manage a Bitbucket repo on our Linux system. I am using Ubuntu 20.04 for this guide, and I’ll make sure that all commands are readily available for all related systems except Debian. The main reason is that you should not implement instructions on a Debian system to avoid any dependency issues.

What is GIT?

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 teams 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 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 Ubuntu 20.04 LTS system.

$ 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 use the free Bitbucket cloud as an example repository, but you can use any other free service like GitHub as well. This repository is just used for testing purposes, you can use any existing remote GIT repository instead, proceed with Step 4 if you have already a remote GIT repo that you like to connect to.

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 the repository settings to connect with Git locally.

Step 4. First clone the repository using the clone link which you will find on top right of the project page.

In our case, the git command will be:

$ git clone https://username@bitbucket.org/username/reponame.git

You must update username and reponame to match with yours.

The whole scenario will go similar to following:

Now type the following command to list your fetched directory on your system

$ ls

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 following command to change the directory

 $ cd

2. Now create a new file using 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.

Conclusion

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.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago