{"id":19840,"date":"2023-07-19T06:09:30","date_gmt":"2023-07-19T06:09:30","guid":{"rendered":"https:\/\/linuxways.net\/?p=19840"},"modified":"2023-07-19T06:10:57","modified_gmt":"2023-07-19T06:10:57","slug":"how-to-install-git-on-debian-12-bookworm","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-git-on-debian-12-bookworm\/","title":{"rendered":"How to Install Git on Debian 12 Bookworm?"},"content":{"rendered":"<p>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.<\/p>\n<p>GitHub is powered by this platform and its installation is really simple. It can be installed in Debian 12 with some simple commands.<\/p>\n<h2><strong>Step 1: Update the System<\/strong><\/h2>\n<p>The first thing that we should do is update our Debian 12 bookworm to make sure everything is updated.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt update <span class=\"sy0\">&amp;&amp;<\/span> upgrade<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"557\" class=\"wp-image-19847\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-1-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-1-1.png 750w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-1-1-300x223.png 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2><strong>Step 2: Installing Git<\/strong><\/h2>\n<p>After the update of our Debian 12, we are ready to install Git in Debian 12.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"kw2\">git<\/span><\/div><\/div>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"574\" class=\"wp-image-19849\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-2-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-2-1.png 767w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-2-1-300x225.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/strong><\/p>\n<h2><strong>Step 3: Confirm the Installation<\/strong><\/h2>\n<p>To confirm the installation of Git, we can check its version. It will ensure if Git has been installed or not.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">git<\/span> <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"558\" class=\"wp-image-19850\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-3-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-3-1.png 763w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-3-1-300x219.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/p>\n<h2><strong>Step 4: Create a User for Git Profile<\/strong><\/h2>\n<p>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.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> user.name <span class=\"st0\">&quot;zubair&quot;<\/span><br \/>\n<span class=\"kw2\">git config<\/span> <span class=\"re5\">--global<\/span> user.email <span class=\"st0\">&quot;youremail@gmail.com&quot;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"752\" height=\"565\" class=\"wp-image-19851\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-4-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-4-1.png 752w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-4-1-300x225.png 300w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/p>\n<h2><strong>Step 5: Initialize Git Repository<\/strong><\/h2>\n<p>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.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">$ <span class=\"kw3\">cd<\/span> Documents<br \/>\n<br \/>\n$ <span class=\"kw2\">git init<\/span><\/div><\/div>\n<p><strong>Step 6: Add files to Git<\/strong><\/p>\n<p>Now we are ready to add files to this Git repository. We have a file with the name as <strong>file.txt<\/strong><\/p>\n<p>For that, use the following command.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">git add<\/span> <span class=\"sy0\">&lt;<\/span>file_name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"567\" class=\"wp-image-19852\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-5-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-5-1.png 763w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-5-1-300x223.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/p>\n<p>Now we need to use one more command to commit the changes and we can add a message with that as well.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">git commit<\/span> <span class=\"re5\">-m<\/span> <span class=\"st0\">&quot;Your message&quot;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"571\" class=\"wp-image-19853\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-6-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-6-1.png 796w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-6-1-300x215.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-6-1-768x551.png 768w\" sizes=\"auto, (max-width: 796px) 100vw, 796px\" \/><\/p>\n<h2><strong>Step 7: Check Git Status<\/strong><\/h2>\n<p>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.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">git status<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"576\" class=\"wp-image-19854\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-7-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-7-1.png 776w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-7-1-300x223.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19840-7-1-768x570.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>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.<\/p>\n<p>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.<\/p>","protected":false},"excerpt":{"rendered":"<p>Git is a version control system that can be used from any platform and from any operating system. We can track any file with it. <\/p>","protected":false},"author":110,"featured_media":19855,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-19840","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=19840"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19840\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/19855"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=19840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=19840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=19840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}