Page MenuHomePhabricator

Unable to identify the reftype of 'refs/remotes/origin/master'. Rejecting push.
Open, Needs TriagePublic

Description

I tried to push to an existing repository, which I previously filled with git push origin --all (cf. T8874). Phabricator replied with Unable to identify the reftype of 'refs/remotes/origin/master'. Rejecting push..

$ git push origin --mirror
Counting objects: 313, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (213/213), done.
Writing objects: 100% (286/286), 146.11 KiB | 0 bytes/s, done.
Total 286 (delta 71), reused 283 (delta 69)
remote: [2015-07-23 12:14:17] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/remotes/origin/master'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:412]
remote: arcanist(head=stable, ref.master=999eb9376568, ref.stable=d54cb072facd), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=stable, ref.master=f0bf7a8e2621, ref.stable=2e82fb07cdc1), phutil(head=stable, ref.master=aa6cd8f7e5e5, ref.stable=83f09
f6c5a03), sprint(head=production, ref.master=4912ecf41ef1, ref.production=2846fc28ae19)
remote:   #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:220]
remote:   #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:124]
remote:   #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:133]
To ssh://phab@phab.../diffusion/PV/paraview.git
 ! [remote rejected] origin/master -> origin/master (pre-receive hook declined)
 ! [remote rejected] upstream/HEAD -> upstream/HEAD (pre-receive hook declined)
 ! [remote rejected] upstream/hooks -> upstream/hooks (pre-receive hook declined)
 ! [remote rejected] upstream/master -> upstream/master (pre-receive hook declined)
 ! [remote rejected] upstream/nightly-master -> upstream/nightly-master (pre-receive hook declined)
 ! [remote rejected] upstream/release -> upstream/release (pre-receive hook declined)
 ! [remote rejected] v0.2.0 -> v0.2.0 (pre-receive hook declined)
 ! [remote rejected] v0.6.0 -> v0.6.0 (pre-receive hook declined)
...
devurandom updated the task description. (Show Details)
devurandom raised the priority of this task from to Needs Triage.
devurandom added a project: Diffusion.
devurandom updated the task description. (Show Details)
devurandom added a subscriber: devurandom.

Same happens when I try to push a branch that exists on a different remote:

$ git push origin upstream/hooks
Counting objects: 202, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (127/127), done.
Writing objects: 100% (195/195), 97.63 KiB | 0 bytes/s, done.
Total 195 (delta 64), reused 194 (delta 64)
remote: [2015-07-23 12:20:15] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/remotes/upstream/hooks'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:412]
remote: arcanist(head=stable, ref.master=999eb9376568, ref.stable=d54cb072facd), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=stable, ref.master=f0bf7a8e2621, ref.stable=2e82fb07cdc1), phutil(head=stable, ref.master=aa6cd8f7e5e5, ref.stable=83f09f6c5a03), sprint(head=production, ref.master=4912ecf41ef1, ref.production=2846fc28ae19)
remote:   #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:220]
remote:   #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:124]
remote:   #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:133]
To ssh://phab@phab.../diffusion/PV/paraview.git
 ! [remote rejected] upstream/hooks -> upstream/hooks (pre-receive hook declined)
error: failed to push some refs to 'ssh://phab@phab.../diffusion/PV/paraview.git'
epriestley added a subscriber: sicnervo.
epriestley added a subscriber: epriestley.

This is probably ultimately the same as T6878 -- T6878#167273 has the current plans here.

Same problem :
Versions :
phabricator bc3ac3158448dfe966d05787fa9272f08ddc7faa (Fri, Jul 1)
arcanist 4d4d16f25985f133501f20fdddd183e525f00341 (Wed, Jun 29)
phutil dde2f74f2793f0216f0d76618ed335a9c802cfec (Fri, Jul 1)

error message :
$ git push --mirror ssh://h***@git.****/diffusion/HGSEIZE/Hg.git
Counting objects: 4087, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1838/1838), done.
Writing objects: 100% (4087/4087), 8.19 MiB | 82.00 KiB/s, done.
Total 4087 (delta 2770), reused 3299 (delta 2186)
remote: [2016-07-03 12:36:14] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/remotes/origin/HEAD'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:404]
remote: arcanist(head=master, ref.master=4d4d16f25985), phabricator(head=master, ref.master=bc3ac3158448), phutil(head=master, ref.master=dde2f74f2793)
remote: #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:205]
remote: #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:116]
remote: #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:186]
To ssh://h****@git.****/diffusion/HGSEIZE/Hg.git
! [remote rejected] develop -> develop (pre-receive hook declined)
! [remote rejected] feat -> feat (pre-receive hook declined)
! [remote rejected] feature-5* -> feature-5* (pre-receive hook declined)
! [remote rejected] feature-c* -> feature-c* (pre-receive hook declined)
! [remote rejected] feature-l* -> feature-l* (pre-receive hook declined)
! [remote rejected] feature-s* -> feature-s* (pre-receive hook declined)
! [remote rejected] master -> master (pre-receive hook declined)
! [remote rejected] origin/HEAD -> origin/HEAD (pre-receive hook declined)
! [remote rejected] origin/develop -> origin/develop (pre-receive hook declined)
! [remote rejected] origin/feat -> origin/feat (pre-receive hook declined)
! [remote rejected] origin/feature-5* -> origin/feature-5* (pre-receive hook declined)
! [remote rejected] origin/feature-c* -> origin/feature-c* (pre-receive hook declined)
! [remote rejected] origin/feature-l* -> origin/feature-l* (pre-receive hook declined)
! [remote rejected] origin/feature-s* -> origin/feature-s* (pre-receive hook declined)
! [remote rejected] origin/master -> origin/master (pre-receive hook declined)
! [remote rejected] origin -> origin (pre-receive hook declined)
error: failed to push some refs to 'ssh://h***@git.***/diffusion/HGSEIZE/Hg.git'4]

epriestley moved this task from Backlog to Triage on the Diffusion board.Feb 2 2017, 4:08 PM
urzds added a subscriber: urzds.Jul 12 2017, 11:08 AM
fabe added a subscriber: fabe.Jul 19 2017, 11:49 AM

We've been experiencing this problem from time to time as well.
In our case between two Phabricator installations.
The internal one observing a repository from a central dev server which always works fine.
Then the internal phabricator has a "mirror" URI configured for the repository to push any changes to an external phabricator installation.
This mirroring fails from time to time with the same error others have posted before (Unable to identify the reftype of 'refs/remotes/... in src/applications/diffusion/engine/DiffusionCommitHookEngine.php:404). Sometimes i could fix it by simply deleting a remote branch that was no longer needed anyway.
I've added a dirty fix now by inserting a "continue;" at line 404 so that the parser in findGitRefUpdates() simply skips unknown ref types and still imports the changes instead of failing completely with an exception.
Though i'm not sure what kind of side effects i might have introduced with this.

michaeloa added a subscriber: michaeloa.EditedFeb 13 2018, 7:53 PM

I'm seeing this currently on our brand-new phabricator install. git push --mirror worked for the first repository installed, but now on the second, this is happening.

This is a big problem, because it essentially prevents us from moving our projects to phabricator.

Counting objects: 968, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (248/248), done.
Writing objects: 100% (968/968), 93.78 KiB | 23.45 MiB/s, done.
Total 968 (delta 391), reused 968 (delta 391)
remote: [2018-02-13 20:42:07] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/pull-requests/2/from'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:414]
remote: arcanist(), phabricator(), phutil()
remote:   #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:215]
remote:   #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:117]
remote:   #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:191]
To http://***/source/***.git
 ! [remote rejected] feature/CreateVmpPage -> feature/CreateVmpPage (pre-receive hook declined)
 ! [remote rejected] feature/PeriodVolumesPAgeElements -> feature/PeriodVolumesPAgeElements (pre-receive hook declined)
 ! [remote rejected] feature/WarningTimeDifferencePopupWindow -> feature/WarningTimeDifferencePopupWindow (pre-receive hook declined)
 ! [remote rejected] master -> master (pre-receive hook declined)
 ! [remote rejected] refs/pull-requests/2/from -> refs/pull-requests/2/from (pre-receive hook declined)
 ! [remote rejected] refs/pull-requests/4/from -> refs/pull-requests/4/from (pre-receive hook declined)
 ! [remote rejected] refs/pull-requests/4/merge -> refs/pull-requests/4/merge (pre-receive hook declined)
error: failed to push some refs to 'http://***/source/***.git

Tried to push from git in both cygwin, git bash, and plain windows. All failed.

So, in my case this turned out to be a well-known issue with git --mirror and the way pull-requests/branches are set up. I was able to clean up the issue for my purposes with this one-liner in the bare repository:

git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d
tekacs added a subscriber: tekacs.EditedApr 3 2018, 1:03 PM

As with @michaeloa's case above, this is a blocker to porting repos of ours over (from Gitlab EE, in our case) for testing purposes.