Git 的三个工作区域

  1. 工作区
  2. 暂存区
  3. Git仓库

Git 提交文件常用命令

1
2
3
4
5
6
7
8
9
10
11
12
git config --list # 查看配置列表
git config --global user.email 'lupanlpb@163.com' # 配置邮箱
git config --global user.name 'lupanlpb' # 配置用户名
git clone https://github.com/lupanlpb/GitLearn.git # 克隆远程仓库到本地
git status # 查看状态
git init # 把这个目录变成Git可以管理的仓库
git add README.md # 文件添加到仓库
git add . # 一个点就把当前目录下所有未追踪的文件全部add了
git commit -m "first commit" # 把文件提交到仓库
git remote add origin git@github.com:username/repositoryname.git # 关联远程仓库
git push -u origin master # 把本地库的所有内容推送到远程库上
git pull origin master # 同步远程的master

Git 关联远程仓库

  1. 配置 SSH Key
  2. 创建远程仓库
    • 登录 GitHub
    • 创建 repository
  3. 关联 GitHub 远程仓库

持续更新中…