Linux 下安装常用软件 git

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

你可能感兴趣的:(git,Linux)