Git简介
Git是什么?
Git是目前世界上最先进的分布式版本控制系统(没有之一)。
Git有什么特点?简单来说就是:高端大气上档次!
第一步:安装wget
yum -y install wget
yum -y install setup
yum -y install perl
依次安装
第二步:去码云下载最新Git包
- 地址:https://github.com/git/git/archive/
linux安装命令:wget https://github.com/git/git/archive/v2.23.0.tar.gz
第三步:在Centos安装相关Git依赖
yum -y install zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtuls-CBuilder perl-ExtUtuls-MakeMaker
第四步:解压安装包
- 在linux环境中解压tar.gz压缩包
- 使用命令
tar -zxvf v2.23.0.tar.gz
第五步:进入git目录
- 命令:
cd git-2.23.0/
第六步:安装GCC
- 命令:
sudo yum install gcc
第七步:执行编译吗命令
make prefix=/usr/local/all
第八步:执行安装命令
make prefilx=/usr/local install
第九步:查看安装结果
- 命令:
git --version
表示安装成功
第十步:使用户git连接github
- 命令:
ssh-keygen -t rsa -C "你的邮箱"
- 生成公钥并存放在/root/.ssh/id_ras.pub
第十一步:查看公钥并复制到github中SSH Key
- 命令:
cd /root/.ssh
cat id_rsa.pub
第十二步:将公钥复制github中
- 注册github https://github.com/
- 进入设置
- 点击SSH and GPG Keys并添加公钥
- 输入名称并将公钥粘贴,点击保存
第十三步:检验连接
- 命令:
ssh -T git@github.com
第十四步:建立Github仓库
- 新建
- 编辑信息
- 获取下载连接url
第十五步:git上传本地文件github仓库
- 进入git目录
cd git-2.23.0/
克隆github文件- 命令:
git clone https://github.com/zimeng-beer/Linux.git
(复制的url)
- 克隆成功
上传到本地仓库- 命令:
git add 文件名
添加上传文件描述- 命令:
git commit -m '描述内容'
上传github仓库- 命令:
git push origin master
在giuhub中分支可查看
问题解决
报错如下:
[root@iZuf66v5ott4itjaz5ijoeZ Linux]# git commit -m 'ces'
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@iZuf66v5ott4itjaz5ijoeZ.(none)')
[root@iZuf66v5ott4itjaz5ijoeZ Linux]# git commit -m "masn"
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@iZuf66v5ott4itjaz5ijoeZ.(none)')
解决办法:
命令:
git config --global user.name "用户名"
git config --global user.email 邮箱@qq.com