一、首先电脑里应该安装Git,这里不再赘述
(另外,后期解决冲突需要使用vscode,或者mergetool图形界面工具kdiff3、beyound compare等)
二、本地项目上传到远程仓库
1.创建本地仓库
在本地项目目录下点击右键,选择Git Bash Here,输入git init命令
2.配置全局变量
git config --global user.name “码云用户名”
git config --global user.email “码云注册邮箱”
3.添加到本地仓库
①将本地项目工作区的文件添加到暂存区
git add . (. 表示所有文件)
②将暂存区的文件提交到本地仓库
git commit -m “注释语句”
4.本地仓库与码云仓库关联
git remote add origin https://gitee.com/xxxxx/xxxx.git(origin就是远程库名)
5.将代码从本地仓库上传到码云仓库:
①git status查看情况,看不看随你
②git pull origin master (push前先pull)
(如果报错:fatal: refusing to merge unrelated histories
使用git pull origin master –-allow-unrelated-histories)
③如果有conflict,先解决,merge之后全部保存
④git push origin master
完成