How to install, configure and use GIT on Ubuntu?

Configurare noua (How To)

Situatie

Git is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed non-linear workflows. Every Git working directory is a full-fledged repository with complete history and full version-tracking capabilities, independent of network access or a central server. GitHub is a Web-based Git repository hosting service, which offers all of the distributed revision control.

Solutie

Pasi de urmat

Installing Git with Default Packages

Step 1: Type the command listed below to launch the Terminal.

Sudo apt-get install git

Installing Git 
  • Installing/Downloading Git from Source
  • Step 1: The first step is to use the command below to update the package list.
  • sudo apt update
  • Step 2:The requirements needed to install git must be installed.
  • sudo apt install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
  • Step 3:Use the following command to download the Git source code from the GitHub website.
  • wget https://github.com/git/git/archive/refs/tags/v2.31.1.tar.gz
  • Step 4:Run the following command to extract the downloaded archive.by using the tar command
  • tar -xvf v2.31.1.tar.gz
  • Step 5: Use the following command to navigate to the extracted directory
  • cd git-2.31.1
  • Step 6: Run the following command to configure the build.
  • make configure
  • Step 7: Set up the script by running the command below
  • ./configure –prefix=/usr/local
  • Step 8: We need to compile the source code which can be done with the help of the following command.
  • make all
  • Step 9: Install Git by using the following command.
  • sudo make install
  • Step 10: Check to see if it is installed and if so, what version is.
    git --version

Before using git, we must set up our GitHub credentials(git config) so that we may use the capability of committing code to the GitHub account. The subsequent commands can be used to do this as shown in the image below

git config --global user.name "****"
git config --global user.email "****"

Configure Git credentials. 

The /.gitconfig file contains all the data that was configured using the aforementioned command, and the following command can list all the configurations.

git config --list

Tip solutie

Permanent

Voteaza

(11 din 18 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?