Linux离线安装Git

Linux环境下离线安装git

简介

本文为lunix 系统下离线安装git,如有安装过git,请先删除git相关文件
centos ,Unbantu 等平台的安装方式略有不同.
复制代码
tar -vxf /usr/local/git/git-2.9.5.tar.gz
复制代码
  • 编译 & 安装
./configure --prefix=/usr/local/git
 make && make install
复制代码
  • 环境变量配置
# 编辑profile文件
vim /etc/profile
# 在porfile最后一行加上 
export PATH=$PATH:/usr/local/git/bin
# 生效配置
source /etc/profile
复制代码
  • 验证是否安装成功
git --version
复制代码
  • 创建git用户,管理git服务
useradd git
passwd git
# 创建仓库
mkdir -p data/git/gittest.git
git init --bare data/git/gittest.git
cd data/git/
chown -R git:git gittest.git/
复制代码
  • 客户端clone
git clone [email protected]:/opt/app/gitdata/gittest.git
复制代码
  • 问题归纳

1.bash: git-receive-pack: command not found fatal: Could not read from remote repository.

  • 解决方法
ln -s /usr/local/git/bin/git-receive-pack /usr/bin/git-receive-pack


作者:zhouhoujun
链接:https://juejin.cn/post/6916794115598319630
来源:掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

猜你喜欢

转载自blog.csdn.net/daocaokafei/article/details/115091354