ARTICLE · INTELLIGENCE

战地情报 · 详情页

来自尧图项目组的一线实战观察与深度解析

如何用git把本地的文件上传到码云中仓库

如何用git把本地的文件上传到码云中仓库 Git 本地仓库与 Gitee 远程仓库冲突解决完整流程一、配置用户信息全局只需执行一次以下命令用于配置 Git 全局用户信息新项目无需重复设置git config --global user.name 你的用户名 git config --global user.email 你的邮箱二、绑定远程仓库第一次关联远程只执行一次添加远程 origin如果提示 origin already exists则改用修改远程地址git remote add origin https://gitee.com/CMJGZ/vue3---fabric.js.git git remote set-url origin https://gitee.com/CMJGZ/vue3---fabric.js.git三、提交本地文件每次改完代码都要执行将所有修改加入暂存区并提交到本地仓库git add . git commit -m 初始化vue3 fabric绘图项目警告 LF will be replaced by CRLF 可直接忽略这是 Windows 正常提示不影响上传。四、推送遇到冲突报错non-fast-forward拉取远程仓库代码合并两个互不相关的提交历史git pull origin master --allow-unrelated-histories如果弹出 vim 编辑器按 Esc 键输入 :wq回车保存退出合并。五、合并完成推送到 Gitee 远程仓库git push origin master配套辅助命令以下命令用于日常查看仓库状态git status git remote -v git log git branch最简一键流程每次改完代码直接用git add . git commit -m 填写本次修改描述 git push origin master只有再次碰到 rejected non-fast-forward 冲突报错才需要执行git pull origin master --allow-unrelated-histories git push origin master补充强制推送备用谨慎使用git push -f origin master作用直接用本地代码覆盖远程仓库多人协作不要随便用新项目测试可用。完整整块复制版git config --global user.name 你的用户名 git config --global user.email 你的邮箱 git remote add origin https://gitee.com/你的用户名/你的仓库.git git remote set-url origin https://gitee.com/你的用户名/你的仓库.git git add . git commit -m 初始化vue3 fabric绘图项目 git push origin master git pull origin master --allow-unrelated-histories git push origin master
RELATED READING

延伸阅读

更多一线实战笔记与深度复盘,助您持续精进