1.码云先创建项目(或者叫仓库)
正常创建即可
2.在本地项目对应的文件夹内操作
3.进入目录
鼠标右键,选择git bash here,输入 git init
4.复制刚刚在码云新建的项目里,框框里的路径
5.继续操作git
输入git remote add origin 你刚刚在码云复制的那行路径
6.使用git add . (. 表示所有的)或者 git add + 文件名
这步操作是将文件保存到暂存区
7.使用git commit -m ‘新添加的文件内容描述’
这是提交代码,和提交的代码的描述信息,提交到本地仓库
例: git commit -m '初始化项目'
8.使用git push origin master
将本地仓库中的最新信息push到远程仓库
期间提示输入用户名密码正常输入(Gitee的用户名密码)即可
9.结束,刷新新创建仓库的页面即可
10可能出现的错误
error: failed to push some refs to 'xxxxx'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
说明在push之前,远程库里已经有文件存在了,应该先pull一下,把已存在的文件全拿下来
git pull origin master
然后再push即可