Debian

How to Install Git on Debian 12 Bookworm?

how to install git on debian 12 bookworm

Git is a platform that almost every coder, software engineer, or even software tester needs. This platform allows the users to manage code, their versions and share with other coders and users.

GitHub is powered by this platform and its installation is really simple. It can be installed in Debian 12 with some simple commands.

Step 1: Update the System

The first thing that we should do is update our Debian 12 bookworm to make sure everything is updated.

$ sudo apt update && upgrade

Step 2: Installing Git

After the update of our Debian 12, we are ready to install Git in Debian 12.

$ sudo apt install git

Step 3: Confirm the Installation

To confirm the installation of Git, we can check its version. It will ensure if Git has been installed or not.

$ git --version

Step 4: Create a User for Git Profile

Just like any other platform, we can create a user here for the git. For that, we need to set a username and email address here.

git config --global user.name "zubair"
git config --global user.email "[email protected]"

Step 5: Initialize Git Repository

Now we are ready to initialize a repository for a git. For that, we will go to our Documents directory and then initialize the repository.

$ cd Documents

$ git init

Step 6: Add files to Git

Now we are ready to add files to this Git repository. We have a file with the name as file.txt

For that, use the following command.

$ git add <file_name>

Now we need to use one more command to commit the changes and we can add a message with that as well.

git commit -m "Your message"

Step 7: Check Git Status

There is a command that we can use to check the status of Git as it will give us detailed information. We can find the state of our Git repository and we can also track the progress.

$ git status

Conclusion

Git is a powerful tool that saves coders and developers a lot of trouble in keeping track of and saving their codes. Not only that, it also helps teams to work and collaborate simultaneously.

Other than that, it is a very lightweight tool that can be installed very easily on any platform. This article was solely focused on how we can install it on Debian 12 bookworm.

Similar Posts