05.git安装

  1. 通过yum安装
yum install git -y
  1. 查看版本
git --version
  1. 本地仓库初始化
mkdir /usr/local/gitRepo
cd  /usr/local/gitRepo
git init
  1. 设置用户名和邮箱
git config --global user.email "[email protected]"
git config --global user.name "evans"
  1. 添加文件
git add 文件名称
  1. 提交到本地仓库
git commit -m"first commit"
  1. 生成密匙,三次确认,默认存放位置,密码为空,确认密码为空
ssh-keygen -t rsa -C "[email protected]"

8.拷贝密匙添加到github上

cd /root/.ssh/
cat id_rsa.put
  1. 常用指令
git --help 查看帮助
git init 初始一个仓库
git add 文件 添加文件
git commit -m "备注" 提交到本地仓库
git clone git://github.com/组织名称/文件仓库名称.git 从远程获取git项目
git config --list 查看git配置的参数属性,如email和name
git status 查看仓库下文件的状态
git log 查看提交记录
git rm 文件 删除文件磁盘不保存
git rm --cache 删除文件磁盘保存 相当于add的反操作
git remote 显示远程仓库
git remote add name url 添加远程仓库
git remote add origin url 关联远程仓库
git pull  更新本地仓库
git push  推送本地仓库到远程

发布了38 篇原创文章 · 获赞 14 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_32257215/article/details/104061916