Can't push to refs/for/master

1,093 views
Skip to first unread message

alan.ma...@gmail.com

unread,
Aug 26, 2013, 6:00:20 AM8/26/13
to repo-d...@googlegroups.com
Hello there!

I get an error message:

user@comp: git push origin HEAD:refs/for/master

fatal: One or more refs/for/ names blocks change upload
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have been changing the access permissions, and believe that the error comes from that. However, currently all the permissions are set to allow. Could this be a bug or am I missing something?

Here are the current permissions. Before the Push was set to Deny.

Reference:
refs/for/refs/*
Push
 
 
Push Merge Commit
 
 

Shawn Pearce

unread,
Aug 26, 2013, 11:47:04 AM8/26/13
to alan.ma...@gmail.com, repo-discuss
On Mon, Aug 26, 2013 at 3:00 AM, <alan.ma...@gmail.com> wrote:
Hello there!

I get an error message:

user@comp: git push origin HEAD:refs/for/master

fatal: One or more refs/for/ names blocks change upload
fatal: Could not read from remote repository.

This error happens because the underlying Git repository has some incorrect references in it.

The way this usually happens is someone pushes to the Git repository directly, without talking to the Gerrit server. For example they have write access to the repository at the UNIX filesystem level and they forget to use the Gerrit URL, like by forgetting to include the port number for Gerrit and instead use the system SSH daemon to write to the repository.

You may be able to discover who did this by looking at the reflogs under logs/refs/for/... within the Git repository on the server.


To fix this, login as your Gerrit server account and go into this Git repository. Look at the output of:

  git for-each-ref | grep refs/for/

This output should be empty. For each refs/for/... name listed by Git you should delete this reference:

  git update-ref -d refs/for/bad-name

This will delete the log files I mentioned above so you may want to look at the log to try and identify the guilty party first. Odds are the party is you. I've done this to my own servers before and its why Gerrit has this check built into it.
Reply all
Reply to author
Forward
0 new messages