Git 与 Gitee 的使用
一、在Gitee上创建仓库
![](https://img-blog.csdnimg.cn/img_convert/480120b7a0ffaf55e6ae7569948c3834.png)
二、配置Git
在目标文件右键 并点击 Git Bash Here
![](https://img-blog.csdnimg.cn/img_convert/40d628ed1c1554393b7ec2a84acb298c.png)
2.配置用户名和邮箱
git config --global user.name ""
git config --global user.email ""
![](https://img-blog.csdnimg.cn/img_convert/00a8e1381e65249d0cf940c7006302be.png)
3.初始化仓库
git init
![](https://img-blog.csdnimg.cn/img_convert/008137ac89c0027bb184fe650d36f602.png)
4.添加项目目录下所有文件至本地仓库
git add .
5.提交注释,有意义的改动信息!
git commit -m '本次提交的说明'
三、本地代码与远程仓库相连接
1.复制远程仓库的http链接
![](https://img-blog.csdnimg.cn/img_convert/ed7d59c6730ffbcf4a619cbf162921dd.png)
2.与远程仓连接
git remote add origin url
3.强行将远程仓库文件(?)更新至指定远程仓库中(如果仓库为空可跳过这一步)
git pull --rebase origin master
4.将本地仓库中的文件推送至指定的远程仓库中
git push -u origin master
在Gitee网页刷新即可
四、删除远程仓库文件
1.在本地所在目录下右键 Git Bash here
2.删除目标文件
git rm -f --cached filename
![](https://img-blog.csdnimg.cn/img_convert/9ece006806177fb535beb05ca233d3e6.png)
3.提交注释
git commit -m "message"
4.推送至远程仓库
git push -u origin master
![](https://img-blog.csdnimg.cn/img_convert/d8c204aa6b988ea9bbc6e92249055087.png)
五、可能报错
Q1 :换行符在不同平台是不一样的
原博客在CSDN > 报错解决方法
warning: in the working copy of '.vscode/tasks.json', LF will be replaced by CRLF the next time Git touches it
A1: 适用于Windows系统
#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true