Home Computer Tutorials Computer Knowledge Git installation process on Ubuntu

Git installation process on Ubuntu

Mar 20, 2024 pm 04:51 PM
git github storage

Git is a fast, reliable, and adaptable distributed version control system. It is designed to support distributed, non-linear workflows, making it ideal for software development teams of all sizes. Each Git working directory is an independent repository with a complete history of all changes and the ability to track versions even without network access or a central server.

GitHub is a Git repository hosted on the cloud that provides all the features of distributed revision control. GitHub is a Git repository hosted on the cloud. Unlike Git which is a CLI tool, GitHub has a web-based graphical user interface. It is used for version control, which involves collaborating with other developers and tracking changes made to scripts and code over time. With GitHub, every team member can create a central cloud-based repository and make changes to data, enabling project collaboration.

This article demonstrates how to get Git on an Ubuntu system.

Git installation on Ubuntu

There are three main ways to install Git on Ubuntu:

  1. Using Ubuntu Package Manager (APT)
  2. Using Git Maintainers PPA
  3. Source: Git

Method 1: Install GIT using the default APT repository on Ubuntu 22.04

Step 1: Update the system

When installing Git on an Ubuntu system, it is crucial to use updated packages. Doing so can help mitigate package conflicts that may arise during the installation process and ensure a smooth installation process.

You can use the "Update" command in the "Advanced Packaging Tool" to update the system's software package.

Sudoku APT update

Output:

Git installation process on Ubuntu

It is recommended to upgrade any outdated packages after the update is complete. Use this command to perform this upgrade:

sudo apt upgrade

Output:

Git installation process on Ubuntu

Step 2: Check if Git exists on Ubuntu

It is recommended to confirm whether Git already exists on your computer before proceeding with the installation. This allows us to avoid repeated installations and keep the system clean.

Use the "git" command and --version to check whether Git already exists in the system. If Git is installed, the previously installed version is displayed:

git——version

Output:

Git installation process on Ubuntu

Step 3: Use APT command

If the previous command returns nothing, it will verify that Git is not installed on your machine. Now it's time to set up Git.

Because it provides an easy-to-use process, we install Git using Ubuntu's repository. Run the "Install" command using sudo apt to install Git.

Sudo apt install git

Output:

Git installation process on Ubuntu

Step 4: Verify that Ubuntu’s GIT installation is successful

After the installation is complete, you should ensure that Git is installed correctly.

Once again, we can use -version to verify the installation. At this point, the following command should return the most recently installed Git version:

Git-version

When the command runs, you should see something like this:

Git installation process on Ubuntu

Method 2: Install GIT on Ubuntu via Git Maintainer PPA

It is sometimes better to use the latest Git version, especially when new features or critical bug fixes are needed. The Ubuntu Git maintenance team maintains the Personal Package Archive (PPA), which is usually the source of the latest stable version of Git. Depending on your specific needs and your work environment, this approach may have a number of major benefits.

Step 1: Import Git Maintainer PPA

We need to add the Git PPA to the system's repository list. Access to the latest stable Git version is guaranteed by this PPA. Even though your system may already have the following packages installed, it's not a bad thing to recheck.

SUDO add-apt-repository-ppa:git-core/ppa

Output:

Git installation process on Ubuntu

Step 2: Refresh package index after PPA import

After importing a Git PPA into the system's repository list, the package index must be refreshed. Now that the repository has been added, your system is able to recognize recently downloaded packages.

To update the package index, do the following:

Sudoku APT update

Step 3: Install git using apt ppa command

Step 3: Install git using apt ppa command

You can upgrade or install Git once the PPA is set up. This command performs this task:

Sudo apt install git-y

Output:

Git installation process on Ubuntu

If you have installed GIT from the Ubuntu repository, you can upgrade Git from the additional PPA to the latest version by running this command.
After the upgrade or installation is completed, confirm the installed Git version:

git——version

Output:

You should see something like this:

Git installation process on Ubuntu

This indicates that the latest version of Git is installed correctly on your computer.

Checking the repository your Git installation came from can give you more information. Because PPAs usually contain a newer version of Git, using the following command should reflect the latest PPA additions:

APT-Cache Strategy Git

Output:

Git installation process on Ubuntu

Method 3: Install Git from source

This method gives the user more control over the installation process and grants access to specific features that may not be included in the prepackaged distribution.

Step 1: Configure Ubuntu using GIT Build Predencies

First, you need to install the necessary build dependencies on your Ubuntu system. These requirements are required for Git compilation. To configure these, use the following commands:

Sudo apt install make libssl-dev libghc-zlib-dev libcurl4-Gnutls-dev libexpat1-dev gettext decompression-y

Output:

Git installation process on Ubuntu

Step 2: Get the GIT source code

Go to the Git release page to get the source code. To download the required version, use the following command. Don't forget to replace {version} with the desired Git version.

curl—o git.tar.gz www.example.com

Output:

Git installation process on Ubuntu

Step 3: Extract and install GIT source code

Now, now compile and install git. To start compilation, use the following command:

sudo tar—xf git.tar.gz

Find and open the unzipped directory:

cd git—2.37.1

Output:

Git installation process on Ubuntu

Now, compile and install git. Start compilation using the following command:

sudo make prefix =/usr/local all

Git installation process on Ubuntu

This command instructs the build system to install in the "/usr/local" folder at the end of the compilation process. The "all" flag ensures a complete build including all components.

After compilation is completed, start the installation:

sudo make prefix =/usr/local install

Output:

Git installation process on Ubuntu

Git is now installed in the "/usr/local" directory. The process involves copying the necessary files and granting the necessary permissions to make Git accessible on your machine.
Verify that the build is accurate and the installation was successful.

git——version

Output:

Git installation process on Ubuntu

This command should confirm that Git is properly integrated into your system by returning your installed version.

in conclusion

Git is a widely used and powerful distributed version control system. This article demonstrates how to install Git on Ubuntu 22.04 and earlier. We discussed three methods: using the Ubuntu Package Manager (apt), using the Git Maintainer PPA, and using Git source code. You can find many online resources, such as the official Git manual, to help you learn how to use Git.

The above is the detailed content of Git installation process on Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the Grayscale Encryption Trust Funds? Common Grayscale Encryption Trust Funds Inventory What are the Grayscale Encryption Trust Funds? Common Grayscale Encryption Trust Funds Inventory Mar 05, 2025 pm 12:33 PM

Grayscale Investment: The channel for institutional investors to enter the cryptocurrency market. Grayscale Investment Company provides digital currency investment services to institutions and investors. It allows investors to indirectly participate in cryptocurrency investment through the form of trust funds. The company has launched several crypto trusts, which has attracted widespread market attention, but the impact of these funds on token prices varies significantly. This article will introduce in detail some of Grayscale's major crypto trust funds. Grayscale Major Crypto Trust Funds Available at a glance Grayscale Investment (founded by DigitalCurrencyGroup in 2013) manages a variety of crypto asset trust funds, providing institutional investors and high-net-worth individuals with compliant investment channels. Its main funds include: Zcash (ZEC), SOL,

Bitwise: Businesses Buy Bitcoin A Neglected Big Trend Bitwise: Businesses Buy Bitcoin A Neglected Big Trend Mar 05, 2025 pm 02:42 PM

Weekly Observation: Businesses Hoarding Bitcoin – A Brewing Change I often point out some overlooked market trends in weekly memos. MicroStrategy's move is a stark example. Many people may say, "MicroStrategy and MichaelSaylor are already well-known, what are you going to pay attention to?" This is true, but many investors regard it as a special case and ignore the deeper market forces behind it. This view is one-sided. In-depth research on the adoption of Bitcoin as a reserve asset in recent months shows that this is not an isolated case, but a major trend that is emerging. I predict that in the next 12-18 months, hundreds of companies will follow suit and buy large quantities of Bitcoin

Significantly surpassing SFT, the secret behind o1/DeepSeek-R1 can also be used in multimodal large models Significantly surpassing SFT, the secret behind o1/DeepSeek-R1 can also be used in multimodal large models Mar 12, 2025 pm 01:03 PM

Researchers from Shanghai Jiaotong University, Shanghai AILab and the Chinese University of Hong Kong have launched the Visual-RFT (Visual Enhancement Fine Tuning) open source project, which requires only a small amount of data to significantly improve the performance of visual language big model (LVLM). Visual-RFT cleverly combines DeepSeek-R1's rule-based reinforcement learning approach with OpenAI's reinforcement fine-tuning (RFT) paradigm, successfully extending this approach from the text field to the visual field. By designing corresponding rule rewards for tasks such as visual subcategorization and object detection, Visual-RFT overcomes the limitations of the DeepSeek-R1 method being limited to text, mathematical reasoning and other fields, providing a new way for LVLM training. Vis

What libraries are used for floating point number operations in Go? What libraries are used for floating point number operations in Go? Apr 02, 2025 pm 02:06 PM

The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

Which libraries in Go are developed by large companies or provided by well-known open source projects? Which libraries in Go are developed by large companies or provided by well-known open source projects? Apr 02, 2025 pm 04:12 PM

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

What is Binance Launchpool? How to participate in Binance Launchpool? What is Binance Launchpool? How to participate in Binance Launchpool? Mar 05, 2025 pm 03:06 PM

Binance Launchpool in-depth analysis: High-yield mining guide and detailed explanation of BIO projects. This article will conduct in-depth discussion of Binance Launchpool, analyze its yield, explain in detail the participation method, and focus on introducing the latest project BIO Coin (BIOl). As the world's largest cryptocurrency exchange, Binance has selected high-quality projects with Launchpool, providing investors with easy mining and opportunities to obtain new tokens. What is Binance Launchpool? Binance Launchpool is a platform that earns new tokens for free by pledging a specified currency. Users can easily earn money by pledging a cryptocurrency. This is similar to new stock subscriptions in the stock market, but there are fewer participants, lower competition, and small investments can also get high returns.

How to obtain the shipping region data of the overseas version? What are some ready-made resources available? How to obtain the shipping region data of the overseas version? What are some ready-made resources available? Apr 01, 2025 am 08:15 AM

Question description: How to obtain the shipping region data of the overseas version? Are there ready-made resources available? Get accurate in cross-border e-commerce or globalized business...

The Berachain main network will be officially launched on February 6! Adopt 3 token BGT, BERA, and HONEY models The Berachain main network will be officially launched on February 6! Adopt 3 token BGT, BERA, and HONEY models Mar 05, 2025 pm 12:18 PM

The Berachain Foundation announced that its Layer1 public chain Berachain main network will be officially launched on February 6, and the token generation event (TGE) will be launched simultaneously. The news was released on Tuesday, and it also previewed that the token economic model and airdrop query tool (Checker) will be announced the next day. Berachain: The EVM-compatible public chain of the Cosmos ecosystem, Berachain is a Layer1 blockchain compatible with Ethereum virtual machine (EVM). It is built on the Cosmos SDK and adopts a unique "Proof of Liquidity (PoL)" consensus mechanism. The PoL mechanism not only enhances network security, but also ensures liquidity supply.

See all articles