我运行git push -u origin master  时提示如下:

To git@github.com:userName/project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:userName/project.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指针向前挪一位,因此拒绝 push 。

我的操作如下:

1、github上创建一个仓库,并且一并创建一个 .gitnore文件

2、本地 git init 一个本地仓库。

3、添加文件,并且 add 和 commit。

4、使用 git push -u origin master 进行第一次提交,并将本地master分支和远程master分支建立关联。

但是出现了以上提示。根据提示,我们知道,可能是因为,远程仓库里面有文件,我们需要先pull下,因此我运行了,git pull origin master。

为什么要运行 git pull origin master 而不是 git pull ,因为目前本地分支的 master 和远程master还没有关联成功。

我 git pull origin master 之后,再运行 git push -u origin master ,ok,提示我push成功了。

git push 提示的更多相关文章

  1. git push提示或错误

    当 git 和 gerrit 一起使用的时候,你创建了一个 tag,现在需要 push 到远程仓库,当你没有权限的时候,会出现如下提示: $ git push origin v20150203 Tot ...

  2. git push 提示 Everything up-to-date

    第一次在 Google Code 上弄项目,注册完毕后,尝试增加一个新文件用以测试 Git 是否好好工作.结果在 Push 时却显示 Every up-to-date,检查文件时却发现实际上一个都没更 ...

  3. Git push提示pre-receive hook declined

    master:local auto@ubuntu:~/src/code/ git push Counting objects: 5, done. Delta compression using up ...

  4. windows 切换git远程仓库地址后 git push 提示Authentication failed

    git切换远程分支: 方法一: git remote set-url origin 你新的远程仓库地址 方法二: git remote rm origin git remote add origin ...

  5. 转 git push 提示 Everything up-to-date

    git 还没有分支,需要指定一个($ git remote -v),就可以push了 第一步:$ git remote -v 第二步:$ git branch 转载链接: http://blog.cs ...

  6. Git Push提示没有权限

    中途协助别人开发的一个小项目, 我已经是该项目的Developer, 可是提交代码依然提示无权限 这是由于我是在master上直接提交的, 而GitLab默认是保护master分支的, push只对M ...

  7. git push时提示"fatal: The current branch master has no..."

    git push到远程仓库时提示:fatal: The current branch master2 has no upstream branch. To push the current branc ...

  8. git push时提示--set-upstream

    问题: 提示需要加--set-upstream

  9. git push提交报错,提示文件过大,且去掉大文件也报同样的错误

    错误原因: 大文件存在没有被提交的commit记录里面: 解决方案: 删除有大文件的commit记录即可 移除大文件的正确姿势 $ git rm --cached giant_file(文件名) # ...

随机推荐

  1. java解析xml禁止校验dtd

    参考: http://shansun123.iteye.com/blog/1020425 http://blog.csdn.net/hailanzhijia/article/details/60049 ...

  2. 微软职位内部推荐-Senior SDE for Win Shell Exp

    微软近期Open的职位: Job posting title: Senior Software Development Engineer Location: China, Beijing Divisi ...

  3. Java 8 VM GC Tunning Guild Charter 9-b

    第九章 G1 GC The Garbage-First (G1) garbage collector is a server-style garbage collector, targeted for ...

  4. Jquery datatables 重载数据方法

    参考这里 { RefreshTable('#table-example', '/BlogManage/GetLabelData'); } function RefreshTable(tableId, ...

  5. android 自定义ratingbar 图片显示不全的解决方案

    在res/style中自定义评分条: <!-- 自定义评分条 --> <style name="roomRatingBar" parent="@andr ...

  6. SQL Server数据库事务日志序列号(LSN)介绍

    原文:http://blog.csdn.net/tjvictor/article/details/5251463     日志序列编号(LSN)是事务日志里面每条记录的编号. 当你执行一次备份时,一些 ...

  7. SQL SERVER开窗函数

    作为一名开发人员来讲,我感觉在职场白混了好多年,可能是自己真的没有进取的精神吧,看了<程序员的SQL金典>这本电子书,真的让我学到了不少知识,真心喜欢这本电子书,书中讲解的内容比较好懂,也 ...

  8. 140304笔记, mysql 更改自动增长字段值的重新设定

    1. 存在同名的或不同的namespace交错情况. Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no result m ...

  9. 对于python的内存管理的好文章

    http://www.cnblogs.com/vamei/p/3232088.html 包含了一个绘制关系图的包

  10. CF 295A Greg and Array (两次建树,区间更新,单点查询)

    #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm& ...