Git使用教程
1.全局设置
设置用户信息,右键桌面打开“Git Bash Here”命令窗口,输入以下命令
git config --global user.name “用户名”
git config --global user.email “邮箱”
用户名:建议使用注册GitHub时,用的用户名
邮箱:建议使用注册GitHub时,用的邮箱
1.1查看配置信息
git config --list
git config user.name
git config user.email
2.创建目录
创建目录时,尽量不要带有中文和空格
在命令窗口中创建目录可以使用:mkdir “目录名称”
也可以自己新建文件夹
3.Git常用命令
- 初始化Git本地仓库:git init
运行成功后,会在所在目录出现一个.git的文件夹,默认是隐藏的。
-
查看当前状态:git status
-
添加文件到缓存区:git add 文件名 (可以一次添加一个文件,也可以一次添加多个文件)
- 语法1:git add 文件名1 文件名2 文件名3
- 语法2&