1.配置單個項目的用戶名和郵箱
$ git config user.name "Your Name"
$ git config user.email "email@example.com"
2.查看當前用戶信息
$ git config --list
3.將項目的所有文件添加到緩存中
$ git add .
4.提交
$ git commit -m "添加描述"
5.拉文件
$ git pull origin master
6.推文件
$ git push origin master
7.生成ssh
$ ssh-keygen -t rsa -C "name@xx.com"
8.查看本地和遠端庫不一致狀態(tài)
$ git status
9.創(chuàng)建.ignore文件
$ touch .gitignore
# 此為注釋 – 將被 Git 忽略
*.a # 忽略所有 .a 結(jié)尾的文件
!lib.a # 但 lib.a 除外
/TODO # 僅僅忽略項目根目錄下的 TODO 文件锌半,不包括 subdir/TODO
build/ # 忽略 build/ 目錄下的所有文件
doc/*.txt # 會忽略 doc/notes.txt 但不包括 doc/server/arch.txt
10.git 初始化
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"