其他分享
首页 > 其他分享> > gitee码云上传代码

gitee码云上传代码

作者:互联网

1、在码云创建项目

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

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

git init
git remote add origin 

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$ 

标签:origin,zhangxm,git,mybatisplus,gitee,码云,master,上传,MacBookPro
来源: https://www.cnblogs.com/xidianzxm/p/12868637.html