git push remote error解决办法
通常在用git clone了remote端(服务器)的git仓库后,再进行了自己一系列修改后,会将自己测试后稳定的状态push到remote端,以更新源仓库,使 其他人在pull的时候得到自己的修改。但是在git push的时候会经常出现如下的错误提示。
remote: error: refusing to update checked out branch: refs/heads/master 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 to remote: error: ‘ignore’ or ‘warn’ in the remote repository to allow pushing into 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 some remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: ‘receive.denyCurrentBranch’ configuration variable to ‘refuse’.
根据上面所报的信息,它的意思就是默认情况下,git不允许用push操作更新non-bare的仓库,因为这样的操作会导致remote仓库的索引 (index)和工作树(work tree)与你push的不一致,此时需要通过‘git reset –hard’操作来使得工作树与HEAD索引相匹配。 可以通过在remote端,设置git的配置文件(.git/config),在其中添加如下内容: [receive]
[receive]
denyCurrentBranch = ignore
这样就可以通过git push提交自己的稳定更新,要想在push后在remote端看到更新的效果,执行git reset –hard即可。
ssh://root@xxx.xxx.xxx.xxx:/data0/htdocs/order
git push remote error解决办法的更多相关文章
- git push失败的解决办法(2)
错误一:Cannot rebase: You have unstaged changes 解决办法: Cannot rebase: You have unstaged changes. 那说明有修改过 ...
- git push出错的解决办法
今天push代码到线上的时候怎么都不行,尝试了很多办法报了好几种错比如: 反正就是各种错,然后其实不管什么错,你全部Git init 一下然后重新配置 git config --global user ...
- unable to access 'https://github.com/shixianqing/img.git/': SSL connect error 解决办法
解决在linux环境下,git clone 项目,走https协议时,报SSL connect error 错误 升级nss yum update -y nss curl libcurl
- windows下git bash中文乱码解决办法
一.解决办法1:(直接上图) 1.在git bash下,右键 出现下图,选择options: 2.选择“Text” 3.将“Character set”设置为 UTF-8 转:windows下git ...
- git push throws error: RPC failed; result=22, HTTP code = 411的解决办法
原因:默认 Git 设置 http post 的缓存为 1MB,将其设置为 500MB 解决办法如下: git config http.postBuffer 524288000
- Git - could not read Username for 'https://github.com',push报错解决办法
执行git push命令异常,如下: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sou ...
- 解决git push出现error: failed to push some refs to 错误
错误截图 背景 码云上创建了空项目 本地项目绑定了远程仓库,尝试git push,然后报了错 解决办法 使用强制命令git pull origin master --allow-unrelated-h ...
- git学习之冲突解决办法
1.如果本地项目和远程服务器的同一文件都有改动,那么就会产生冲突,导致git pull 失败,报错见下. 解决办法:先执行git stash指令,暂存当前的改动状态,再执行git pull指令,就可以 ...
- Linux] Git: push 出错的解决 master -> master (branch is currently checked out)
在使用Git Push代码到数据仓库时,提示如下错误: [remote rejected] master -> master (branch is currently checked out ...
随机推荐
- 设置mysql group_concat长度
#在MySQL配置文件(my.ini)中默认无该配置项,使用默认值时,值为1024,可在客户端执行下列语句修改: #SET GLOBAL group_concat_max_len = 1024; #该 ...
- 【MySQL】MySQL主从库配置和主库宕机解决方案
1.转载:https://blog.csdn.net/zfl589778/article/details/51441719/ 2.效果:亲测有效,数据写入成功. 3.主机宕机后,如果不是长时间宕机,且 ...
- git for windows配置SSH key
0. 前言 之前用过一段时间的git,后来迁移系统导致电脑中的git bash消失了,由于在上家公司版本管理用的svn,所以一直没有重新配置,目前工作中版本管理用的gitLab,后期计划将工作之外的精 ...
- Comparable 与 Comparator
Comparable & Comparator 都是用来实现集合中元素的比较.排序的,只是 Comparable 是在集合内部定义的方法实现的排序,Comparator 是在集合外部实现的排序 ...
- linux达人养成计划学习笔记(二)—— 文件查找命令
一.locate命令 1.命令格式: locate 文件名 2.locate在后台数据库中按文件名搜索,速度快,locate命令所搜索的后台数据库 /var/lib/mlocate 3.后台数据库跟新 ...
- 安卓高手之路之ClassLoader(二)
因为ClassLoader一定与虚拟机的启动有关系,那么必须从Zygote的启动开始看代码.下面就分析一下这些代码,行数不多: int main(int argc, const char* const ...
- 使用itext直接替换PDF中的文本
直接说问题,itext没有直接提供替换PDF中文本的接口(查看资料得到的结论是PDF不支持这种操作),不过存在解决思路:在需要替换的文本上覆盖新的文本.按照这个思路我们需要解决以下几个问题: itex ...
- Charles 网络抓包工具
1.Charles 简介 Charles 是在 Mac.Linux 或 Windows 下常用的 http 协议网络包截取工具,在平常的测试与调式过程中,掌握此工具就基本可以不用其他抓包工具了.Cha ...
- span的赋值与取值
1.<span id="span_id">span的文本</span>的取值. js取<span>的值并不是用document.getEle ...
- Linux增加swap空间
1.添加交换文件并设置其大小为12G,使用如下命令 # dd if=/dev/zero of=/home/swapfile bs=1024 count=12288000 12288000+0 reco ...