码迷,mamicode.com
首页 > 系统相关 > 详细

linux下安装git

时间:2018-03-19 22:42:10      阅读:311      评论:0      收藏:0      [点我收藏+]

标签:git

1:git安装

	1.1:安装git环境准备
	1.2:创建用户及配置家目录
	1.3:编译安装
	1.4:环境配置
	1.5:配置帮助文件
	1.6:查看版本
	1.7:认证



git下载地址:

     https://mirrors.edge.kernel.org/pub/software/scm/git/


1:git安装

  1.1:安装git环境准备

yum -y install gcc openssl openssl-devel curl curl-devel unzip perl perl-devel expat expat-devel zlib zlib-devel asciidoc xmlto gettext-devel openssh-clients

 

   1.2:创建用户及配置家目录

[root@testss git]# useradd -r -s /bin/bash -d /home/git git
[root@testss git]# mkdir /home/git
[root@testss git]# chown git.git /home/git/ -R

  

  1.3:编译安装

[root@testss git-2.9.5]# tar xf git-2.9.5.tar.xz 
[root@testss git-2.9.5]# cd git-2.9.5
[root@testss git-2.9.5]# ./configure --prefix=/usr/local/git --with-openssl --with-libpcre 
[root@testss git-2.9.5]# make -j 2 && make -j 2 install


  1.4:环境配置

[root@testss git-2.9.5]# echo "export PATH=/usr/local/git/bin/:$PATH" > /etc/profile.d/git.sh
[root@testss git-2.9.5]# source !$


  1.5:配置帮助文件

[root@testss git-2.9.5]# /usr/local/git/share
[root@testss share]# ln -sv man/ /usr/share/

  

  1.6:查看版本

[root@testss share]# git --version
  git version 2.9.5


  1.7:认证

[root@testss share]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
34:25:50:bd:96:f9:63:c7:f8:a3:c7:76:2c:c5:c5:79 root@testss
The key's randomart image is:
+--[ RSA 2048]----+
|      .oo..      |
|         o.      |
|        o  +   ..|
|       . .=    .E|
|        S. . o .o|
|            = o o|
|           . = o |
|              B o|
|            .+ + |
+-----------------+

// 配置用户权限
[root@testss share]# cd /home/git
[root@testss git]# mkdir .ssh
[root@testss git]# chmod 700 .ssh/
[root@testss git]# chmod 600 /home/git/.ssh/authorized_keys 
[root@testss git]# chown git.git .ssh/ -R

//建立双机互信
[root@testss git]# cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys

// git免密登陆
[root@testss git]# cat ~/.ssh/id_rsa.pub > /home/git/.ssh/authorized_keys





linux下安装git

标签:git

原文地址:http://blog.51cto.com/xiong51/2088755

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!