Git学习之常见错误 git push 失败
Git学习之常见错误 git push 失败
问题描述:
git push
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | 445.00 KiB/s, done.
Total (delta ), reused (delta )
remote: error: refusing to update checked out branch: refs/heads/5.1
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable t
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in som
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, se
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ...
解决办法:
这是由于git默认拒绝了push操作,根据提示信息解决:
You can set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into...
进入项目的目录下的.git目录,编辑config文件:
增加一项配置:
[receive]
denyCurrentBranch = ignore
然后再次执行 git push,就可以成功了。
这是服务器上看不到刚提交的文件,需要执行:
git reset --hard
然后就OK了。
在初始化远程仓库时最好使用 git init --bare
而不要使用:git init
Git学习之常见错误 git push 失败的更多相关文章
- Git学习之常见错误 clone被拒绝
Git学习之常见错误 问题: git clone 时 报错 Permission Denied (权限被拒绝). 解决方法: 需要把本地的公钥上传到服务器. 解决步骤: ①第一步,设置本地的git的用 ...
- Git 学习笔记--删除错误提交的commit
如果不小心把错误的commit给commit了,可以对其进行撤销 1.使用git log查看commit日志,找到错误提交前一版本commit的哈希值; 2.使用git reset --hard co ...
- Git学习笔记01--常用Git命令、cmd命令及Git总结性知识
资源:外国网友制作的 Git Cheat Sheet 第二次学习廖雪峰老师的Git教程,学习过程中把教程中涉及到的Git命令及总结性知识记录下来方便二次复习. 知识点 所有的版本控制系统,其实只能跟踪 ...
- git学习利器:《Git Pro》中文版
Git书籍有<版本控制之道git>,但是很一般.强烈推荐<Git Pro>中文版! 很多开源软件的教程也是免费开源的在线阅读的. <Git Pro>中文版在线阅读h ...
- Git学习笔记(windows git之初体验)
阿里国内镜像地址: https://npm.taobao.org/mirrors/git-for-windows/ 最近在学习廖雪峰老师关于git的教程,链接可以在我的首页找到.首先使用国内镜像下载并 ...
- 【Git学习笔记】初始化Git仓库和版本回退
学习地址 http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 什么是版本库呢?版本库又 ...
- git学习笔记03-本地git常用操作及原理-文件增删改
1.查看git状态 git status 这个可以告诉我们对git做了哪些操,比如增删改 2.既然我们修改了东西,有的时候想看看修改了什么,毕竟我们的记忆力并不如电脑 git diff 文件名 (默 ...
- git学习笔记之二 -- git分支
前面对git基础作了简单的总结,这次对git的杀手锏--分支做一总结. Git分支简介 几乎每个版本控制系统都以某种形式支持分支,可以使你的工作从开发主线上分离开来,以免影响开发主线.很多版本控制系统 ...
- git学习笔记——廖雪峰git教程
OK,先附上教程--廖雪峰的官方网站 友情连接:git官网 简介 这里我只想引用他的原文: Linus可以向BitMover公司道个歉,保证以后严格管教弟兄们,嗯,这是不可能的.实际情况是这样的: L ...
随机推荐
- python pandas 中 loc & iloc 用法区别
转自:https://blog.csdn.net/qq_21840201/article/details/80725433 ### 随机生DataFrame 类型数据import pandas as ...
- 第8章 应用协议 图解TCP/IP 详解
第8章 应用协议 图解TCP/IP 详解 8.1 应用层协议概要 应用层协议的定义 TCP和IP等下层协议是不依赖上层应用类型.实用性非常广的协议.而应用协议则是为了实现某种应用而设计和创造的协议. ...
- K-means算法Java实现
public class KMeansCluster { private int k;//簇的个数 private int num = 100000;//迭代次数 ...
- Javaweb学习笔记4—Reuest&Response
今天来讲javaweb的第四段学习. Request和Response还是比较重要的 老规矩,首先先用一张思维导图来展现今天的博客内容. ps:我的思维是用的xMind画的,如果你对我的思维导图感兴趣 ...
- VINS-Fusion代码阅读(四)
pts_i和pts_j:具体指什么含义?(分别为第l个路标点在第i, j个相机归一化相机坐标系中的观察到的坐标,P¯¯¯cil \bar{P}^{c_i}_l Pˉ lc i 和 P¯¯¯cjl ...
- droplang - 删除一种 PostgreSQL 过程语言
SYNOPSIS droplang [ connection-option...] langname [ dbname] droplang [ connection-option...] --list ...
- DECLARE - 定义一个游标
SYNOPSIS DECLARE name [ BINARY ] [ INSENSITIVE ] [ [ NO ] SCROLL ] CURSOR [ { WITH | WITHOUT } HOLD ...
- C++ 类中的static成员的初始化和特点
C++ 类中的static成员的初始化和特点 #include <iostream> using namespace std; class Test { public: Test() : ...
- C程序(1)
- CSS中列表项list样式
CSS列表属性 属性 描述 list-style-属性 用于把所有用于列表的属性设置于一个声明中. list-style-image 将图象设置为列表项标志. list-style-position ...