linux编译安装git

用的centos6.4中自带的git,版本为1.7.1,配置好github的sshkey后,clone下来的项目无法提交,提示:

fatal: Unable to find remote helper for 'https'

网上查阅后,参照http://stackoverflow.com/questions/8329485/git-clone-fatal-unable-to-find-remote-helper-for-https发现是由于安装时少安装cur-devell模块的原因,需要重新编译安装。

于是安装curl-devel:

$ yum install curl-devel
$ # cd to wherever the source for git is
$ cd /usr/local/src/git-1.7.9  
$ ./configure
$ make
$ make install

但make的时候发生警告:

注意:如果机器只安装了libcurl,而没有安装libcurl-devel包,是没法进行编译的。他们两个区别是:

libxxx相当于只有动态库的部分  只能被编译好的程序运行的时候链接,但缺少部分头文件的源代码,所以不能编译。如果是编译为动态库,需要libxxx-devel里边的头文件,如果要编 译为静态的则需要里边的头文件和c文件都需要,所以libxxx-devel对要编译一个程序的时候是必不可少的。看考http://stackoverflow.com/questions/2358801/what-are-devel-packages 

command not found:curl-config

去/usr/bin目录和/usr/local/bin等常见目录寻找后均没发现,使用locate命令寻找:

[money@money study]$ locate curl-config
/opt/vagrant/embedded/bin/curl-config
/opt/vagrant/embedded/share/man/man1/curl-config.1

才发现原来我这个版本的是在opt目录下,于是在/usr/bin目录下做了个软链接,然后编译就通过了。

再次执行最上边的安装步骤,安装成功并且上传没有出现问题。

原文地址:https://www.cnblogs.com/yamadie/p/3488596.html