CentOS7编译Git2.0.1报错:找不到curl/curl.h文件求助
Hey friend, that error shows up because your CentOS 7 system is missing the libcurl development headers—Git relies on these to build its HTTP/HTTPS-related features. Let's get this sorted out step by step:
Step 1: Install the missing dependency
First, install the curl-devel package which includes the missing curl/curl.h header file. Run this with sudo privileges:
sudo yum install curl-devel
If you want to avoid other potential missing dependency errors down the line, you can install a full set of common build dependencies for Git in one go:
sudo yum install gcc autoconf zlib-devel openssl-devel expat-devel gettext-devel curl-devel
Step 2: Recompile Git
Navigate back to your Git source directory if you moved away from it:
cd git-2.0.1
Then re-run the compile command you used earlier:
make prefix=/usr/local/git all
Step 3: Install Git (after successful compilation)
Once the build finishes without errors, install Git to your specified location:
sudo make prefix=/usr/local/git install
To make Git accessible system-wide, add its bin directory to your PATH. Edit your ~/.bashrc file and append this line at the end:
export PATH=/usr/local/git/bin:$PATH
Reload the shell configuration to apply the change immediately:
source ~/.bashrc
You can confirm the installation worked by checking the Git version:
git --version
内容的提问来源于stack exchange,提问作者sof-03

