git基本使用
1.下载
window官网地址:https://gitforwindows.org/
官网点击downLoad,注意自己的操作系统是32还是64。
双击安装,可更改目录,尽量放在纯英文路径下面。
安装成功后,就可以使用git命令行了,在想要下载代码的路径下面右击Git Bash Here
1.创建文件名:mkdir
2. 文件名初始化:git init
3. 查看目录 :ls
4.查看目录: ls -a (可多看一个.git文件)
5.创建txt文件并带有内容:echo "hello world">first_git.txt
6.查看当前git版本库状态:git status(在Untracked file未跟踪文件下会出现红色first_git.txt代表未被git管理)
7.加入修改 : git add frist_git.txt
8.加入所有修改:git add .
9.提交:git commit -m"注释“(有人会用git commit会报错,请使用git commit -m "注释")
当报错如下
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
只需要添加两行代码:
git config --global user.email "邮箱"
git config --global user.name "名称"