git push 提示 git fatal: Unable to find remote helper for ‘https‘ 错误

登陆到远程linux服务器上,使用git, clone的时候报“fatal: Unable to find remote helper for 'https'”错,没管,绕过,使用git clone git://....协议download下来项目。

但是到提交完要push回服务器的时候,必须得用https,搜了一下问题,是系统中没有curl,都是要装curl的,比如:

yum install curl-devel

或者apt-get等

但是问题来了,远程服务器上没有sudo到root的权限怎么办?

得自己安装curl,从curl - Download下载到最新的curl包:

curl-7.41.0.tar.gz

解压,然后make并安装:

./configure --prefix=/home/{username}/curl/

make

make install

安装好后,再尝试git push,还是报一样的错。

想到应该需要重新编译并安装git,执行:

./configure --prefix=/home/{username}/git/ --with-curl=/home/{username}/curl/

注意这里一定要使用--with-curl参数,指定到上面安装的curl目录,git只有与curl库做link之后,才能使用https功能。

再次make & make install

git push成功。

本次解决问题的经验教训:

实际上是重新编译时先使用./configure --prefix=/home/{username}/git/未果后才思考的,执行./configure --prefix=/home/{username}/git/ &> config.log,把log重定向到这个文件里打开,搜curl,发现curl的状态是no,表明这个configure没有找到curl,那么自然后面在make的时候也就无法完成link,然后./configure -h,看到--with-curl参数,想起需要指定,才搞定问题。

经验教训是遇到问题还是要自己思考一下原理,网上搜的文章都是有root权限的前提下能装到系统默认位置的方案,没有想原理,另外要注意观察日志,帮助理解问题。

附安装git教程:

删除旧版本:

[root@localhost test1]# yum remove git

安装编译新版版本:

[root@localhost test1]#  cd /usr/local/src/

[root@localhost test1]#  wget https://www.kernel.org/pub/software/scm/git/git-2.15.1.tar.xz

[root@localhost test1]#  tar -vxf git-2.15.1.tar.xz

[root@localhost test1]#  cd git-2.15.1

[root@localhost test1]#  make prefix=/usr/local/git all

[root@localhost test1]#  make prefix=/usr/local/git install

[root@localhost test1]#  echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile

[root@localhost test1]#  source /etc/profile

[root@localhost test1]#  git --version

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DQZ_cool

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值