搭建git服务器和源码安装
创建git用户和组
groupadd -g 11111 git useradd -md /home/git -g 11111 -u 11111 git
安装依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel yum install git
创建证书登录
su - git
ssh-keygen 一路回车即可 cd /home/git/ chmod 0755 .ssh touch .ssh/authorized_keys chmod 0600 .ssh/authorized_keys
# 若B机器的用户user2需要克隆A机器上用户user1的仓库,则需要将B机器的用户user2下的公钥添加到A机器上用户user1下的授权列表authorized_keys中。
创建仓库
su - git cd /home/git mkdir -p repository/dream cd repository/dream git init --bare --shared dream.git
其他机器克隆仓库
# 将公钥添加上去才能克隆
git clone git@192.168.1.111:/home/git/repository/dream/dream.git
root@SK-20200604SUIE MINGW64 ~/Desktop/work/igoodful/maths (master) $ git push Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 421.60 MiB | 6.32 MiB/s, done. Total 4 (delta 1), reused 0 (delta 0), pack-reused 0 remote: error: unable to create temporary file: ??????? remote: fatal: failed to write object error: remote unpack failed: unpack-objects abnormal exit To 192.168.199.228:/home/git/data/maths/maths.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to '192.168.199.228:/home/git/data/maths/maths.git'
#######################################
原因:linux上的磁盘满了,无法写入了
#######################################
git源码安装
一、源码编译安装Git
大体的安装步骤如下:
①、获取github最新的Git安装包下载链接,进入Linux服务器,执行下载,命令为: wget https://github.com/git/git/archive/v2.17.0.tar.gz ;
②、压缩包解压,命令为: tar -zxvf v2.17.0.tar.gz ;
③、安装编译源码所需依赖,命令为: yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker 耐心等待安装,出现提示输入y即可;
④、安装依赖时,yum自动安装了Git,需要卸载旧版本Git,命令为: yum remove git 出现提示输入y即可;
⑤、进入解压后的文件夹,命令 cd git-2.17.0 ,然后执行编译,命令为 make prefix=/usr/local/git all 耐心等待编译即可;
⑥、安装Git至/usr/local/git路径,命令为 make prefix=/usr/local/git install ;
⑦、打开环境变量配置文件,命令 vim /etc/profile ,在底部加上Git相关配置信息:
PATH=$PATH:/usr/local/git/bin
export PATH
或着
vim /etc/profile.d/git.sh
----------
PATH=$PATH:/usr/local/git/bin
export PATH
----------
source /etc/profile
⑧、输入命令 git --version ,查看安装的git版本,校验通过,安装成功。
二、传送门
https://www.cnblogs.com/imyalost/p/8715688.html
#####################################