Linux 下安装常用软件 git

10 篇文章 1 订阅

Git 安装

  1. 检查是否已安装 git
    1. find / -name git
      
      // 如果存在 查看git 版本
      
      git --version
      
      如果版本合适,那就不用看下面的安装过程了,不合适将其移除
      
      yum -y remove git

       

  2. 安装
    1. wget https://github.com/git/git/archive/v2.27.0.tar.gz
      
      2)解压:#tar -zxvf v2.27.0.tar.gz
      
      3)安装依赖包:#yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
      
           注意:安装依赖时,会默认以yum方式安装 git,我们需要手动卸载
      
      4)编译:#cd git-2.27.0 ; #make prefix=/usr/local/git all
      
      5)安装git至指定目录:#make prefix=/usr/local/git install
      
      6)配置环境变量:#vim /etc/profile

       

 

如果遇到

libgit.a(utf8.o): In function `reencode_string_iconv’:
/opt/git-master/utf8.c:530: undefined reference to `libiconv’
libgit.a(utf8.o): In function `reencode_string_len’:
/opt/git-master/utf8.c:569: undefined reference to `libiconv_open’
/opt/git-master/utf8.c:588: undefined reference to `libiconv_close’
/opt/git-master/utf8.c:582: undefined reference to `libiconv_open’

解决,安装 libiconv 即可

https://ftp.gnu.org/gnu/libiconv/
wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz
tar -xvf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure --prefix=/usr/local/libiconv && make && make install

然后 git 重新安装

make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make && make install

1)配置环境变量:#vim /etc/profile

2)重新加载:#source /etc/profile

3)查看版本:#git --version

[root@localhost git-2.27.0]# git --version
git version 2.27.0

配置SSH

1)本地生成key #ssh-keygen -t rsa -C "你的邮箱@qq.com"

2)查看生成的key #cat  ~/.ssh/id_rsa.pub

3)在github个人账户配置key

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值