一、上传
1.配置你的用户名和邮箱
git config --global user.name "xxx"
git config --global user.email "xxx"
查看
git config user.name
git config user.email
2.上传文件
git init
git add . ( 文件名)
git commit -m '本次提交的说明'
复制仓库的http
git remote add origin xxx (xxx为http链接)
强制将远程仓库文件更新至指定远程仓库中
git pull --rebase origin master
将本地仓库中的文件推送至指定的远程仓库中
git push -u origin master
二、下载
git clone xxx(仓库链接)
三、报错
![](https://i-blog.csdnimg.cn/blog_migrate/a67bbdf2b8bc987862e1e5f3ad4abf33.png)
执行 git remote rm origin 删除关联的origin的远程库
git remote rm origin
在执行
git remote add origin xxx (xxx为http链接)
![](https://i-blog.csdnimg.cn/blog_migrate/23e211e2f79e5fb7ca88a6fb46da83df.png)
先把远程repo pull到本地,然后再push。
git pull origin main
git push origin main
四、取消git追踪
git rm -r --cache 文件夹名/