Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push fails with deny updating hidden ref

Tags:

git

gitlab

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 '[email protected]: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 = [email protected]:auser/dotfiles.git
     fetch = +refs/heads/*:refs/heads/*
     fetch = +refs/tags/*:refs/tags/*
     fetch = +refs/change/*:refs/change/*
     pushurl = [email protected]: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.

like image 224
slackline Avatar asked Nov 18 '25 11:11

slackline


1 Answers

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

enter image description here

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.

enter image description here

like image 98
Mohammed NAIMI Avatar answered Nov 20 '25 02:11

Mohammed NAIMI



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!