引用https://www.cnblogs.com/u-1596086/p/11588957.html 右上角头像按钮,点击your repositories 接着绿色按钮:new 接着就是命名,再点击create respositoory,就在git上创建好了项目。 第二步,关联远程仓库 1,创建成功之后,我们会看到仓库的地址,如下:git@github.com:lenve/test.git,然后我需要将我们之前的本地仓库和这个远程仓库进行关联,使用git remote add命令,如下: $ git remote add origin git@github.com:lenve/test.git 在这条命令中,git会自动将远程仓库的名字设置为origin,方便我们的后续操作。 2,假设我想将本地master分支上的内容推送到远程master分支上,方式如下: $ git push -u origin master $ git checkout fire 引用https://blog.csdn.net/sinat_36246371/article/details/79738782(原文链接) git pull git pull origin master git branch --set-upstream-to=origin/master master 引用https://www./2018/03/git-%E5%87%BA%E7%8E%B0-fatal-refusing-to-merge-unrelated-histories-%E9%94%99%E8%AF%AF/ git pull 失败 ,提示:fatal: refusing to merge unrelated histories 其实这个问题是因为 两个 根本不相干的 git 库, 一个是本地库, 一个是远端库, 然后本地要去推送到远端, 远端觉得这个本地库跟自己不相干, 所以告知无法合并 具体的方法, 一个种方法: 是 从远端库拉下来代码 , 本地要加入的代码放到远端库下载到本地的库, 然后提交上去 , 因为这样的话, 你基于的库就是远端的库, 这是一次update了 第二种方法: git pull origin master --allow-unrelated-histories 后面加上 --allow-unrelated-histories , 把两段不相干的 分支进行强行合并 后面再push就可以了 git push gitlab master:init gitlab是别名 , 使用 Java代码 master是本地的branch名字 本地必须要先add ,commit完了 才能推上去 关于这个问题,可以参考http:///questions/37937984/git-refusing-to-merge-unrelated-histories。 在进行git pull 时,添加一个可选项 git pull origin master --allow-unrelated-histories |
|