Git

官方手册

[Git - Book](Git - Book)

本地配置GitLab SSHKey

  • 打开Git Bash ,输入命令:ssh-keygen -t rsa -C "youremail@example.com" ,目的是生成本地密钥
  • 登陆GitLab,打开“settings”,“SSH Keys”页面,复制本地用户/登陆用户/.ssh文件夹下生成的 id_rsa.pub文件的内容

Git Config设置

级别

  • 仓库级别: git config --local -l
  • 用户级别:git config global -l
  • 系统级别:git config system -l

操作配置

  • 编辑配置文件 git config --local -e
  • 查看配置文件 git config --list / -l
  • 添加配置 git config [–local|–global|–system] –add section.key value(默认是添加在local配置中)
  • 获取配置 git config [–local|–global|–system] –get section.key(默认是获取local配置中内容)
  • 删除配置 git config [–local|–global|–system] –unset section.key

设置name和email

  • 本仓库范围:git config user.name “gitlab's Name” git cnfig user.email “gitlab@xx.com”
  • 用户全局范围:git config –global user.name “xxxxx” git config –global user.email “xxxxx@xx.com”

直接删除服务器文件

git rm --cached filename/-r directory
git commit "xxxx"
git push

CentOS安装Git

yum install curl-devel expat-devel gettext-devel \ openssl-devel zlib-devel
yum install git-core
posted @ 2021-01-07 22:19  天蓝隐湘  阅读(93)  评论(0编辑  收藏  举报