首先保证电脑上已经下载安装好git,没有的可以去官网下载
1. 准备工作
两件事:
① 新建一个仓库
② 完成SSH Key的加密
-
在c盘用户下的.ssh目录里找到id_rsa和id_rsa.pub这两个文件,复制id_rsa.pub里面的内容  -
按照箭头顺序打开New SSH key  -
把复制的内容添加到Title(Title可以随便填)下面的Key内容框里面,最后点击Add SSH key,这样就完成了SSH Key的加密 
2. 右键点击要上传的文件,选择Git Bash Here

3. 把项目提交给仓库
-
git init -
git status // 非必要,查看文件夹内部所有文件 -
git add . // 注意空格和. -
图示:  这里报了一个错: error: 'my-vue-manage/' does not have a commit checked out
fatal: adding files failed
主要原因是因为my-vue-manage文件夹下又隐藏的.get文件,删掉就又好了,具体方法:
- 首先进入该文件内:
cd my-vue-manage/ - 输入:
rm -rf .get - 最后不要忘记退出:
cd .. - 图示:
 -
然后再重新上传文件:git add . -
git commit -m 'submit' -
git remote add origin https://github.com/surymy/vue-manage.git :origin后边就是你自己再github上创建的仓库地址 -
git push -u origin master
这里又出了一个错误:
fatal: unable to access 'https:
键入: - git config --global --unset http.proxy - git config --global --unset https.proxy - 然后会出来一个弹窗,输入自己的username和password进行身份验证,最后成功的界面:
  最后:
git push -u origin main  打开自己的github,会发现文件已经上传成功了! 
4. 其他错误汇总
error: src refspec main does not match any error: failed to push some refs to 'https:
这个是因为本地(一般是master)和gitub(一般是main)仓库名称不一样,导致不能关联,修改一下:
git branch -m master main
|