记录自己在迁移行云上项目中的遇到问题
迁移步骤
1. 行云下载项目到本地
2.gitlab 上创建新项目
这里就不多说了
3.尝试与远程建立关联
a. 这边本地代码如果有很多分支,首先要取消本地与远程teambition的git关联
git remote remove origin
b. 尝试与gitlab上面的仓库建立关联
git remote add origin git@github.com:git_username/repository_name.git
这边继续git push 的话会出现这个问题
#出现问题:error: 无法推送一些引用到 'https://github.com/Rich-yi/wfw-MVC.git'提示:更新被拒绝,因为您当前分支的最新提交落后于其对应的远程分支。
提示:再次推送前,先与远程变更合并(如 'git pull ...')。详见
提示:'git push --help' 中的 'Note about fast-forwards' 小节。
c.使用git pull
出现的问题:fatal: 拒绝合并无关的历史#解决:
d.需要将远程仓库和本地仓库关联起来
git branch --set-upstream-to=origin/master master
#然后使用git pull整合远程仓库和本地仓库
git pull --allow-unrelated-histories#忽略版本不同造成的影响
4.push 分支代码
本地分支关联完成并且更新完代码后,就可以push 本地代码到远程了
本地的其他分支可以依次与远程建立链接 并push,比如develop分支
先切换develop分支
git push --set-upstream origin develop