linux下安装git
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下安装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:创建用户及配置家目录
[[email protected] git]# useradd -r -s /bin/bash -d /home/git git [[email protected] git]# mkdir /home/git [[email protected] git]# chown git.git /home/git/ -R
1.3:编译安装
[[email protected] git-2.9.5]# tar xf git-2.9.5.tar.xz [[email protected] git-2.9.5]# cd git-2.9.5 [[email protected] git-2.9.5]# ./configure --prefix=/usr/local/git --with-openssl --with-libpcre [[email protected] git-2.9.5]# make -j 2 && make -j 2 install
1.4:环境配置
[[email protected] git-2.9.5]# echo "export PATH=/usr/local/git/bin/:$PATH" > /etc/profile.d/git.sh [[email protected] git-2.9.5]# source !$
1.5:配置帮助文件
[[email protected] git-2.9.5]# /usr/local/git/share [[email protected] share]# ln -sv man/ /usr/share/
1.6:查看版本
[[email protected] share]# git --version git version 2.9.5
1.7:认证
[[email protected] 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 [email protected] The key's randomart image is: +--[ RSA 2048]----+ | .oo.. | | o. | | o + ..| | . .= .E| | S. . o .o| | = o o| | . = o | | B o| | .+ + | +-----------------+ // 配置用户权限 [[email protected] share]# cd /home/git [[email protected] git]# mkdir .ssh [[email protected] git]# chmod 700 .ssh/ [[email protected] git]# chmod 600 /home/git/.ssh/authorized_keys [[email protected] git]# chown git.git .ssh/ -R //建立双机互信 [[email protected] git]# cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys // git免密登陆 [[email protected] git]# cat ~/.ssh/id_rsa.pub > /home/git/.ssh/authorized_keys
以上是关于linux下安装git的主要内容,如果未能解决你的问题,请参考以下文章