本次教程使用gitee,其它平台也一样。
1. 新建一个仓库仓库的名字和本地你的项目的文件夹名字一致(注:创建时,不要选初始化,直接创建)。
即我本地存在一个文件夹xbench
进入项目的文件夹,我的叫xbench
cd xbench
若之前该项目是从别人的git仓库clone下来的,则先提前删除.git文件
rm -rf .git
git init
git add .
git commit -m "first commit"
git remote add origin https://gitee.com/maxphper/xbench.git
git push -u origin master
最终提交成功
注:git设置提交的用户名和邮箱
git config --global user.name "maxphper"
git config --global user.email "896776703@qq.com"