热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

这种push如何做?

两台电脑,pc1pc2.

两台电脑,pc1 pc2.



pc1 push project1 到 https://xxxx@github.com/xxxx/...

1
2
3
4
5
git init

git add  project1/

git commit -m "from pc1"  

git remote add origin  ttps://xxxx@github.com/xxxx/yyyy.git

git push -u origin master

成功了。



现在需要将pc2上面的project2 ,push到 https://xxxx@github.com/xxxx/...
下面在pc2上使用相同的代码

1
2
3
4
5
git init

git add  project2/

git commit -m "from pc1"  

git remote add origin  https://xxxx@github.com/xxxx/yyyy.git

git push -u origin master

报错

error: failed to push some refs to 'https://xxxx@github.com/xxxx/...'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

代码修改为

1
2
3
4
5
6
7
rm -rf .git

git init

git add  project2/

git commit -m "from pc1"  

git remote add origin  https://xxxx@github.com/xxxx/yyyy.git

git pull

git push -u origin master

报错:
error: failed to push some refs to 'https://xxxx@github.com/xxxx/...'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

代码继续修改为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
rm -rf .git

git init

git add  project2/

git commit -m "from pc1"  

git remote add origin  https://xxxx@github.com/xxxx/yyyy.git

git pull origin master



报错





    From https://xxxx@github.com/xxxx/yyyy.git

 * branch            master     -> FETCH_HEAD

 * [new branch]      master     -> origin/master

fatal: refusing to merge unrelated histories



git push -u origin master



报错



error: failed to push some refs to 'https://xxxx@github.com/xxxx/yyyy.git'

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
请问,如何解决?


   



推荐阅读
  • 本文详细介绍了git常用命令及其操作方法,包括查看、添加、提交、删除、找回等操作,以及如何重置修改文件、抛弃工作区修改、将工作文件提交到本地暂存区、从版本库中删除文件等。同时还介绍了如何从暂存区恢复到工作文件、恢复最近一次提交过的状态,以及如何合并多个操作等。 ... [详细]
  • 初始化初始化本地空版本库,仓库,英文名repositorymkdirtest&&cdtestgitinit克隆项目到本地gitclone远程同 ... [详细]
  • 先记住几个专用名词,如下:Workspace:工作区IndexStage:暂存区Repository:仓库区(或本地仓库)Remote:远程仓库一、新建代码库#在当前目录新建一个G ... [详细]
  • Git GitHub多人协作
    在学校做一个小项目需要多人协作,就用到了gitHub,百度了一下多数写得乱七八糟或者支离破碎,于是总结了一下自己的步骤如下,第一次使用GitHUb,哪里不对望大神指出一.前期准备: ... [详细]
  • 双十一在家学用 Git
    对于所有的开发者来说,掌握一门代码版本控制系统都是必须的,无论是自己做项目,团队合作,工作中的合作,都离不开版 ... [详细]
  • 使用在线工具jsonschema2pojo根据json生成java对象
    本文介绍了使用在线工具jsonschema2pojo根据json生成java对象的方法。通过该工具,用户只需将json字符串复制到输入框中,即可自动将其转换成java对象。该工具还能解析列表式的json数据,并将嵌套在内层的对象也解析出来。本文以请求github的api为例,展示了使用该工具的步骤和效果。 ... [详细]
  • 前言本篇为大家总结社区多人合作常见的场景和对应的git操作命令。本篇非新手教程,阅读本篇前需具备Git基础知识。Git入门教程请参考https://www ... [详细]
  • 本文介绍了在git中如何对指定的commit id打标签,并解决了忘记打标签的问题。通过查找历史提交的commit id,可以在任意时间点打上标签。同时,还介绍了git中的一些常用命令和操作。 ... [详细]
  • 十大经典排序算法动图演示+Python实现
    本文介绍了十大经典排序算法的原理、演示和Python实现。排序算法分为内部排序和外部排序,常见的内部排序算法有插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。文章还解释了时间复杂度和稳定性的概念,并提供了相关的名词解释。 ... [详细]
  • 2016 linux发行版排行_灵越7590 安装 linux (manjarognome)
    RT之前做了一次灵越7590黑苹果炒作业的文章,希望能够分享给更多不想折腾的人。kawauso:教你如何给灵越7590黑苹果抄作业​zhuanlan.z ... [详细]
  • Thisworkcameoutofthediscussioninhttps://github.com/typesafehub/config/issues/272 ... [详细]
  • Problemexplanation: ... [详细]
  • 图解 Google V8 # 19 :异步编程(二):V8 是如何实现 async/await 的?
    说明图解GoogleV8学习笔记前端异步编程的方案史1、什么是回调地狱?如果在代码中过多地使用异步回调函数,会将整个代码逻辑打乱,从 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • Ihavethisfollowinginputfile:我有以下输入文件:test.csvdone_cfg,,,,port<0>,clk_in,subcktA,ins ... [详细]
author-avatar
谦谦骄子_458
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有