How to install git for linux source code
How to install git from Linux source code: 1. Download the git source code and upload it to the Linux server; 2. Log in to the target machine, decompress and install; 3. Install "gcc gcc-c"; 4. Perform the git installation Just order.
The operating environment of this article: linux5.9.8 system, git version 2.9.5, Dell G3 computer.
How to install git from Linux source code?
Linux installation git/source code installation:
Git installation
I won’t record Windows/Mac OS systems here. Just download the corresponding installation program and install it according to the steps.
Linux installation
Log in to https://git-scm.com/download/linux
Source code installation
1. Download the source code
You can download the source code on another computer and then upload it to the Linux server
https://mirrors.edge.kernel.org/pub/software/scm/git/
to find the corresponding version.
2. Upload to the server
Using git-2.9.5.tar.gz as an example, upload the downloaded file to the server.
scp git-2.9.5.tar.gz root@192.168.0.102:/home/tools
scp git-2.9.5.tar.gz Target machine user@target machine ip: target machine path
3. Unzip and install
Log in to the target machine, Unzip and install. /home/Git refers to the installation directory
tar -zxvf git-manpages-2.9.5.tar.gz cd git-2.9.5 [root@localhost git-2.9.5]# ./configure --prefix=/home/Git [root@localhost git-2.9.5]# make && make install 4. ./configure 报错 [root@localhost git-2.9.5]# ./configure --prefix=/home/Git configure: Setting lib to 'lib' (the default) configure: Will try -pthread then -lpthread to enable POSIX Threads. configure: CHECKS for site configuration checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/home/tools/git-2.9.5': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
It can be seen from my Linux server execution error that gcc, cc, cl.exe is no. gcc is the c language compiler for Linux, which means these compilers are not installed on my machine.
Install the following gcc and gcc-c respectively. After successful installation, execute the git installation command
[root@localhost git-2.9.5]# yum install gcc [root@localhost git-2.9.5]# yum install gcc-c++ [root@localhost git-2.9.5]# ./configure --prefix=/home/Git
5. The make command reports an error
[root@localhost git-2.9.5]# make && make install * new build flags CC credential-store.o In file included from credential-store.c:1:0: cache.h:40:18: 致命错误:zlib.h:没有那个文件或目录 #include <zlib.h> ^
The compilation is interrupted.
make: *** [credential-store.o] Error 1
The zlib header file is missing and the development package is not installed. Install zlib
[root@localhost git-2.9.5]# yum install zlib [root@localhost git-2.9.5]# yum install zlib-devel [root@localhost git-2.9.5]# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker [root@localhost git-2.9.5]# make && make install
If no error is reported, the installation is successful
6. Check whether the git installation is completed
Enter the previously specified installation directory and check the git version, it will be successful It means that the git installation is complete
[root@localhost bin]# cd /home/Git/bin [root@localhost bin]# ./git --version git version 2.9.5
7. Configure environment variables
vi /etc/profile
Edit the environment variable configuration file, append the following string at the end, and specify the address of the bin directory
export PATH=$PATH://home/Git/bin
After the modification is completed, execute the command to take effect in the configuration file
source /etc/profile
Check whether the configuration is successful. You can switch the path to another directory and execute git --version. Returning to the git version indicates that the environment variable configuration is completed.
Recommended study: "Git Tutorial"
The above is the detailed content of How to install git for linux source code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Cryptocurrency data platforms suitable for beginners include CoinMarketCap and non-small trumpet. 1. CoinMarketCap provides global real-time price, market value, and trading volume rankings for novice and basic analysis needs. 2. The non-small quotation provides a Chinese-friendly interface, suitable for Chinese users to quickly screen low-risk potential projects.

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

How to set the SpringBoot project default run configuration list in Idea using IntelliJ...

In IntelliJ...

About SpringCloudAlibaba microservices modular development using SpringCloud...

Abstract of the first paragraph of the article: When choosing software to develop Yi framework applications, multiple factors need to be considered. While native mobile application development tools such as XCode and Android Studio can provide strong control and flexibility, cross-platform frameworks such as React Native and Flutter are becoming increasingly popular with the benefits of being able to deploy to multiple platforms at once. For developers new to mobile development, low-code or no-code platforms such as AppSheet and Glide can quickly and easily build applications. Additionally, cloud service providers such as AWS Amplify and Firebase provide comprehensive tools
