-
删除系统自带的git
yum remove git
-
去git下载对应安装包 github.com/git/git/rel…
-
安装依赖
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
-
解压
tar -zxvf v2.21.0.tar.gz
-
进入解压目录
cd git-2.21.0/
-
编译
make prefix=/usr/local/git all
-
安装
make prefix=/usr/local/git install
-
编辑环境配置文件
vim /etc/profile
末尾添加
export PATH=/usr/local/git/bin
-
使之生效
source /etc/profile
-
查看git版本
git --versiob
-
全局配置用户名
git config --global user.name "nameVal"
-
全局配置邮箱
git config --global user.email "eamil@qq.com"
-
配置编码
git config --global core.autocrlf false git config --global core.quotepath false git config --global gui.encoding utf-8
git 公钥配置
-
在终端输入
ssh-keygen -t rsa -C "xx@163.com"
-
一路回车,不要输入任何密码之类,生成ssh key pair
-
ssh-add ~/.ssh/id_rsa
如果出现 Could not open a connection to your authentication agent.
-
执行
eval
ssh-agent
出现
Agent pid 14578
-
再执行
ssh-add ~/.ssh/id_rsa
此时出现
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
-
查看公钥
cat ~/.ssh/id_rsa.pub
出现的一串字符串填入git
此时可以使用 SSH 克隆代码
git clone git@github.com:xxx/xxx.git
=========================================================================
使用这中http方式 拉去代码时 git clone http://username[@ip](my.oschina.net/u/3749391):…
如下配置:
进入服务器的项目目录,执行
[root@slave5 ~]# git config --global credential.helper store
执行之后,继续项目代码路径git pull
[root@slave5 BigData.XNYKDX.ETL]# git pull
重新输入一遍账号密码。然后往后就不需要再输入了
Buy me a cup of coffee :)