centos install git

参考文章

install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# prepare
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc -y
sudo yum install gcc perl-ExtUtils-MakeMaker -y

git --version

sudo yum remove git -y


# install git
cd /usr/local/src/

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.xz --no-check-certificate

tar -vxf git-2.23.0.tar.xz
cd git-2.23.0

sudo make prefix=/usr/local/git all

sudo make prefix=/usr/local/git install

sudo echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile

source /etc/profile

git --version

生成SSH密钥

1
2
git config --global user.name "luochunhai"
git config --global user.email "469608976@qq.com"
1
ssh-keygen -t rsa -C "469608976@qq.com"
1
cat ~/.ssh/id_rsa.pub

添加密钥到GitHub

打开 Github,登录自己的账号后
点击自己的头像->settings->SSH And GPG Keys->New SSH key

将本地 id_rsa.pub 中的内容粘贴到 Key 文本框中,随意输入一个 title(不要有中文),点击 Add Key 即可

centos里测试验证

1
ssh git@github.com

评论