首页 > Web开发 > 详细

gitee码云上传代码

时间:2020-05-11 15:10:10      阅读:71      评论:0      收藏:0      [点我收藏+]

1、在码云创建项目

在码云上按照提示创建项目

2、本地git添加远程库与本地库的关联

git init
git remote add origin https://gitee.com/xidianzxm/mybatisplus.git
or
git remote add origin git@gitee.com:xidianzxm/mybatisplus.git

3、本地提交

git add .
git commit -m "first commit"

4、拉取远程更新

git fetch

5、更新与本地合并

MacBookPro:mybatisplus zhangxm$ git merge origin/master
fatal: 拒绝合并无关的历史
MacBookPro:mybatisplus zhangxm$  git pull origin master --allow-unrelated-histories 
来自 gitee.com:xidianzxm/mybatisplus
 * branch            master     -> FETCH_HEAD
Merge made by the ‘recursive‘ strategy.
 LICENSE      | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 README.en.md |  36 ++++++++++++++++++++++++++++
 README.md    |  37 ++++++++++++++++++++++++++++
 3 files changed, 274 insertions(+)
 create mode 100644 LICENSE
 create mode 100644 README.en.md
 create mode 100644 README.md

6、上传最新的代码

MacBookPro:mybatisplus zhangxm$ git push origin master
枚举对象: 49, 完成.
对象计数中: 100% (49/49), 完成.
使用 4 个线程进行压缩
压缩对象中: 100% (28/28), 完成.

问题

MacBookPro:mybatisplus zhangxm$ git pull origin master
来自 gitee.com:xidianzxm/mybatisplus
 * branch            master     -> FETCH_HEAD
fatal: 拒绝合并无关的历史
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$ git merge origin master --allow-unrelated-histories
merge:origin - 不能合并
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$ git push origin master
To gitee.com:xidianzxm/mybatisplus.git
 ! [rejected]        master -> master (non-fast-forward)
error: 推送一些引用到 ‘git@gitee.com:xidianzxm/mybatisplus.git‘ 失败
提示:更新被拒绝,因为您当前分支的最新提交落后于其对应的远程分支。
提示:再次推送前,先与远程变更合并(如 ‘git pull ...‘)。详见
提示:‘git push --help‘ 中的 ‘Note about fast-forwards‘ 小节。
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$ git pull origin master
来自 gitee.com:xidianzxm/mybatisplus
 * branch            master     -> FETCH_HEAD
fatal: 拒绝合并无关的历史
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$ git fetch origin
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$ git merge origin/master
fatal: 拒绝合并无关的历史
----------------------------------------------------------------------------------------
MacBookPro:mybatisplus zhangxm$  git pull origin master --allow-unrelated-histories 
来自 gitee.com:xidianzxm/mybatisplus
 * branch            master     -> FETCH_HEAD
Merge made by the ‘recursive‘ strategy.
 LICENSE      | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 README.en.md |  36 ++++++++++++++++++++++++++++
 README.md    |  37 ++++++++++++++++++++++++++++
 3 files changed, 274 insertions(+)
 create mode 100644 LICENSE
 create mode 100644 README.en.md
 create mode 100644 README.md
MacBookPro:mybatisplus zhangxm$ git push origin master
枚举对象: 49, 完成.
对象计数中: 100% (49/49), 完成.
使用 4 个线程进行压缩
压缩对象中: 100% (28/28), 完成.
写入对象中: 100% (48/48), 9.78 KiB | 1.63 MiB/s, 完成.
总共 48(差异 2),复用 0(差异 0),包复用 0
remote: Powered by GITEE.COM [GNK-5.0]
To gitee.com:xidianzxm/mybatisplus.git
   49d1136..5889cb3  master -> master
MacBookPro:mybatisplus zhangxm$ 

gitee码云上传代码

原文:https://www.cnblogs.com/xidianzxm/p/12868637.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!