最近在看GIT的相关教程,是廖雪峰老师的教程:
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
这个教程是从入门开始的,所以也还比较好懂。教程的前半部分都是在本地的操作,一切都是没有什么问题的,但是当要把本地的代码push到远程仓库的时候,就遇到了一个小的问题。因为我是在github上建立了一个learngit的仓库,并且建立的时候,顺便勾选建立readme.md文件,作为仓库的第一个提交。
下面是我的执行过程。
$git remote add origin git@github.com:xfxlch/learngit.git //添加远程主机名
$git push -u origin master //把本地的master分支代码push到远程仓库的master分支上。
这个时候得到了下面的错误。
引用
To git@github.com:xfxlch/learngit.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xfxlch/learngit.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 pull origin master
执行完之后,什么都提示都没有,然后我再想去push代码的时候,仍然出现了之前的错误。
我很沮丧,就去Google了,然后找到了
http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to
引用
git pull --rebase origin master
git push origin master
完整的是这样的
引用
luchenghaodeMacBook-Air:learngit luchenghao$ git pull --rebase origin master
From github.com:xfxlch/learngit
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: add readme
Applying: udpated
Applying: small change
Applying: understand how stage works
Applying: check git status
Applying: add test.txt
luchenghaodeMacBook-Air:learngit luchenghao$ git push origin master
Counting objects: 18, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (18/18), 1.48 KiB | 0 bytes/s, done.
Total 18 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), done.
To git@github.com:xfxlch/learngit.git
4587b43..a5dca30 master -> master
他会replay之前的操作,就是相当于把我在本地的commit和在github上的commit做一次 彩排,到底哪个先哪个后,按时间顺序排一下,然后再push的时候,就可以正常提交了。
--EOF--
分享到:
相关推荐
解决fatal:remote error:You can’t push to git://github.com/username/*.git问题的办法 今天Git push的时候 fatal:remote error: You can't push to git://github.com/username/*.git Use git@github....
学习git的基本操作时,遇到问题error: failed to push some refs to 'https://gitee.com/xiao-longlong/git-test.git' 解决办法:先执行git pull --rebase origin master 然后执行git push origin master即可
Github—failed to push some refs to ‘https://github.com/***/git_project.git’解决办法报错详情 报错详情 git version 2.26.2.windows.1 因为没有提交内容到master,需要先提交 先设置User.email、user.name ...
error: failed to push some refs to 'git@gitee.com:yanxiaoxin98/hair.git' 死都push不上去
$ npm install -g refs 示例:YAML 模板: AWSTemplateFormatVersion : ' 2010-09-09 ' Resources : - $ref : ./relative/path/to/file.yaml RolePolicies : $ref : ./resources/role-policies.yaml Type : ...
git push origin master 报错的解决方法,分享给大家,具体如下: 错误提示如下 ...error: failed to push some refs to 'git@github.com:kangvcar/Results-Systems--PHP.git' hint: Updates were r
Issue 11442: Fix push failing with internal server error sporadically when notedb.changes.read=True is configured. Issue 11444: Fix the wrong progress output during online migration in error_log and ...
skeemas-json-refs 用于解析轻量级解决方案安装npm install skeemas-json-refs用法 var jsonRefs = require ( 'skeemas-json-refs' ) ,refs = jsonRefs ( ) ;refs . add ( '/some/uri/ref' , { nested : { foo : '...
dokku-deploy-github-action 此操作使部署到Dokku尽可能容易! 输入项 ssh-私钥 用于Dokku部署的ssh私钥。 切勿将其用作纯文本!... error: failed to push some refs to 'dokku@mydokkuhost.com:mydokkurepo'
json-refs json-refs是一个用于与和进行交互的简单库。 尽管此库的主要目的是提供JSON引用功能,但由于JSON引用是Object结构和JSON Pointer的组合,因此该库还为JSON指针提供了一些功能。 项目徽章 生成状态: ...
1.关于this.$refs的使用场景 如果ref属性加在普通元素上,那么this.$refs.name则指向该DOM元素 ”p”>hello <!– this.$refs.p 指向该DOM元素 –> 如果ref属性加在组件上,那么this.$refs.name指向该组件实例 ...
React使用动态参考用 create-react-library 制作安装npm install --save use-dynamic-refs用法 import React , { useEffect } from 'react' ;import useDynamicRefs from 'use-dynamic-refs' ;const Example = ( ) =...
会报错error: failed to push some refs to 'git@github.com:fatpandaria/T-blog.git' hint: Updates were rejected because the tip of your current branch is behind,这是因为没有git pull,一般进行push要先...
Git使用方法
合并引用 将React引用合并为一个的函数。 如果只给出了一个有效的引用,则也会过滤掉无效的(例如虚假的)引用,并返回原始引用。 tl; dr 通过执行npm install merge-refs... // I'm going to be updated! const ref2
React合并引用 React Utility合并引用 :linked_paperclips: npm install react-merge-refs例子 import React from "react" ;import mergeRefs from "react-merge-refs" ;const Example = React . forwardRef ( ...
REFS3000注册机
committed, the command line prompt script failed to notice the current status, which has been improved. * Many GIT_TEST_* environment variables control various aspects of how our tests are run, ...
详细描述了refs文件系统逆向工程的技术细节,refs是微软的新一代文件系统,是闭源的,因此逆向工程将您带入到refs文件系统结构的神秘世界.
npm install -g pkg-refs 用法 带有简短格式pkgd的命令行工具。 短时间后,它将列出所有依赖项和描述。 # search package name online pkgd # parse local package.json pkgd < package.json package.json | ...