git push 失败,拒绝更新隐藏的引用 [英] git push fails with deny updating hidden ref

查看:685
本文介绍了git push 失败,拒绝更新隐藏的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我的 dotfiles 的存储库,并去从一个分支推送更改只是遇到......

$ git push枚举对象:46,完成.计数对象:100% (46/46),完成.写入对象:100% (46/46),3.20 MiB |1.52 MiB/s,完成.总计 46 个(增量 0),重复使用 0 个(增量 0)到 gitlab.com:auser/dotfiles.git![远程拒绝] 木村->origin/kimura(拒绝更新隐藏的参考)![远程拒绝] 主人->origin/master(拒绝更新隐藏的参考)错误:未能将一些参考推送到 'git@gitlab.com:auser/dotfiles.git'

正确的方法是在你克隆的本地仓库中打开 git bash 并执行正确的命令,这也可能是你的问题.

I've a repository for my dotfiles and went to push changes from a branch only to encounter...

$ git push
Enumerating objects: 46, done.
Counting objects: 100% (46/46), done.
Writing objects: 100% (46/46), 3.20 MiB | 1.52 MiB/s, done.
Total 46 (delta 0), reused 0 (delta 0)
To gitlab.com:auser/dotfiles.git
 ! [remote rejected] kimura -> origin/kimura (deny updating a hidden ref)
 ! [remote rejected] master -> origin/master (deny updating a hidden ref)
error: failed to push some refs to 'git@gitlab.com:auser/dotfiles.git'

This thread suggests its because pull requests made on origin and links to a blog post with solution of how to skip this, although I do not explicitly have refs/pull in the path thats being rejected so it may be a different issue but I couldn't find much info on this so figured I try the proposed solution and updated my config to...

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git@gitlab.com:auser/dotfiles.git
        fetch = +refs/heads/*:refs/heads/*
        fetch = +refs/tags/*:refs/tags/*
        fetch = +refs/change/*:refs/change/*
        pushurl = git@gitlab.com:auser/dotfiles.git
        push = +refs/heads/*:refs/remotes/origin/*
[submodule "oh-my-zsh/.oh-my-zsh"]
        url = https://github.com/robbyrussell/oh-my-zsh
        active = true
[branch "master"]
        remote = origin
        merge = refs/heads/master
        pushRemote = origin
[branch "kimura"]
        remote = origin
        merge = refs/heads/kimura
        fetch = +refs/heads/*:refs/heads/*
        fetch = +refs/tags/*:refs/tags/*
        fetch = +refs/change/*:refs/change/*

But the problem persists. My branches are...

$ git branch -a
* kimura
  master
  remotes/origin/kimura
  remotes/origin/master

The host I'm trying to push from is where I started the repo before mirroring to Gitlab.

解决方案

I had the same error [remote rejected] origin/myBranch (deny updating a hidden ref)

The problem was:

I cloned a remote repo mobile into a folder, then, I made modifications on the code, and when I tried to push, instead of pushing the local repo mobile to the remote one, I was trying to push its parent

The right way was to open git bash inside the local repo you have cloned and execute the right commands, this may be your problem too.

这篇关于git push 失败,拒绝更新隐藏的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆