如何解决failed to push some refs to git

Administrator@PC-20150110FGWU /K/cocos2d/yc (master)

$ git push -u origin master

To git@github.com:yangchao0718/cocos2d.git

 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to 'git@github.com:yangchao0718/cocos2d.git

hint: Updates were rejected because the tip of your current branch is behin

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

方法/步骤

  1. 1

    在使用git 对源代码进行push到gitHub时可能会出错,信息如下

    3.出现错误的主要原因是github中的README.md文件不在本地代码目录中

    4.可以通过如下命令进行代码合并   git pull --rebase origin master

    5.、执行上面代码后可以看到本地代码库中多了README.md文件

    6此时再执行语句 git push -u origin master即可完成代码上传到github

git --- ! [rejected] master -> master (non-fast-forward)的更多相关文章

  1. Git 分支管理 不使用Fast forward模式进行合并 分支管理策略

    通常,合并分支时,如果可能,Git会用Fast forward模式,但这种模式下,删除分支后,会丢掉分支信息. 如果要强制禁用Fast forward模式,Git就会在merge时生成一个新的comm ...

  2. Git分支(3/5) -- 禁用 Fast Forward 合并

    添加一个分支, 并且换到该分支: git checkout -b add-text 然后我再index.html里面添加点文字, 并commit. 然后再修改README.md, 添加文字, comm ...

  3. git push origin master 报错 remote rejected] master -> master (branch is currently checked out)

    解决办法: 977down vote You can simply convert your remote repository to bare repository (there is no wor ...

  4. git push解决办法: ! [remote rejected] master -> master (pre-receive hook declined)

    前天准备上传一个project到GitLab上,但是试了很多次都上传不上去,报错如下: ! [remote rejected] master -> master (pre-receive hoo ...

  5. git将本地内容传送到远程仓库出现![rejected] master -> master (fetch first)错误

    问题:使用git push -u 远程库名 master 命令将本地提交的内容传到git远程库时出现错误: 命令: git push -u origin master 出现错误: To https:/ ...

  6. Push rejected: Push master to origin/master was rejected /failed to push some refs to /git did not exit cleanly

    用studio提交代码报 Push rejected: Push master to origin/master was rejected 用TortiuseGit提交代码报下面错,(我是用这种方法解 ...

  7. [rejected] master -> master (fetch first)(non-fast forward)

    git push 时候遇到的错误: hint: Updates were rejected because the tip of your current branch is behind hint: ...

  8. git 解决push报错:[rejected] master -> master (fetch first) error: failed to push some refs to

    今天对代码进行了修改优化,然后往往远程push,但push后报错了 git操作 git add . git commit -m"fix" git push origin maste ...

  9. git提交远程报错[rejected] master -> master (fetch first)

    1 先下载git for windows 然后一直点下一步安装. 2 安装之后,选择git gui.生成ssh 链接 git 公钥. 用命令也可以: $ ssh-keygen -t rsa -C &q ...

  10. Git push时报错 ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to......

    今天在使用Git回退到之前某个版本的代码时,进行push时出现如下错误: ! [remote rejected] master -> master (pre-receive hook decli ...

随机推荐

  1. 集合 List和Set

    分别向Set集合以及List集合中添加“A”,“a”,“c”,“C”,“a”5个元素,观察重复值“a”能否在List集合以及Set集合中成功添加. List<String> ls=new ...

  2. NodeJS学习笔记 (32)安全加密-tls

    https://github.com/chyingp/nodejs-learning-guide

  3. BZOJ5017 炸弹(线段树优化建图+Tarjan+拓扑)

    Description 在一条直线上有 N 个炸弹,每个炸弹的坐标是 Xi,爆炸半径是 Ri,当一个炸弹爆炸时,如果另一个炸弹所在位置 Xj 满足:  Xi−Ri≤Xj≤Xi+Ri,那么,该炸弹也会被 ...

  4. 【转】 我的java web登录RSA加密

    [转] 我的java web登录RSA加密 之前一直没关注过web应用登录密码加密的问题,这两天用appscan扫描应用,最严重的问题就是这个了,提示我明文发送密码.这个的确很不安全,以前也大概想过, ...

  5. Flexible implementation of a system management mode (SMM) in a processor

    A system management mode (SMM) of operating a processor includes only a basic set of hardwired hooks ...

  6. 洛谷 P1125 笨小猴

    P1125 笨小猴 题目描述 笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼.但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大! 这种方法的具体描述如下:假设max ...

  7. 读 Paxos 到 ZooKeeper ¥ 50大洋

    一  初识 ZooKeeper              高效且可靠的分布式协调服务.解决分布式一致性问题             统一命名服务.配置管理服务.分布式锁服务.      使用: 比如配 ...

  8. C#做的CPU内存使用率

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  9. nyoj 1104 just for you

    just for you 时间限制:1000 ms  |  内存限制:65535 KB 难度:0 描写叙述 今天tlp和ly想去看电影了到了电影院才发现买票的人特别多 .ly不想让tlp等着急了,就先 ...

  10. HDU 1520 Anniversary party(DFS或树形DP)

    Problem Description There is going to be a party to celebrate the 80-th Anniversary of the Ural Stat ...