-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git push has some rejections #36
Comments
You're not in trouble! However this is something I could cover with better documentation - issue #16 relates to this. The refs beginning 'refs/pull' are synthetic read-only refs created by GitHub - you can't update (and therefore 'clean') them, because they reflect branches that may well actually come from other repositories - ones that submitted pull-requests to you. So, while you've pushed all your real refs, the pull requests don't get updated. There's no real way to fix them with your existing repo with the GitHub admin tools. The severity of an issue depends on whether you were trying to remove any 'private' data:
|
So if you get this error does that mean BFG has fixed the problem, or not? |
Hey there, could this be possibly related to the fact that BFG has duplicated most of my commit history after deleting a file from it? I have the bfg-report for reference. |
In order to change Git history (ie to change a repo to make it look like that file was never added) brand new commits have to be created. This is how Git works - every commit-id reflects a hash of it's history - change the history, change the commit id. To delete a file, you have to create new 'clean' commit history, and throw away the old 'dirty' history. So yes, your commit history has been duplicated, but that's essential. And this can be awkward if you have old pull requests lying around, pointing to the old history. |
does this mean that bfg can't "clean" your history on any github repository that has had pull requests "touching" any file you're trying to remove? what i mean is, you look at the history (on github) and you can see that the history has been re-written and the file(s) you're cleaning out cannot be seen on the commits but if you go through the pull request history or if you still have the hash for the commit the file was introduced in (as an example), you can still see it (and its contents). unless i'm wrong. so in order for someone to remove a file for sure they'd have to:
i have a public repo in which (i believe) this issue is easily seen, in case i didn't explain myself appropriately. |
I just try to run bfg without deleting any files, without any open push requests, and it fails, too: This is what I did:
After that I tried to follow the suggestions at http://stackoverflow.com/questions/34265266/remote-rejected-errors-after-mirroring-a-git-repository and did following:
with the following config with updated fetches:
But still without effect (see output above) :-( The repository in this case is: No (open) push requests, only 1 additional branch - so it should be very simply, isn't it? |
I think you mean Pull Requests. You are distinguishing open PRs from closed ones, however GitHub is retaining a (read-only) ref for each PR, regardless of whether it is open or closed. This allows you to later view the PR and the diffs it represents, even if that history would have been otherwise lost/garbage-collected if it were not merged into an ongoing branch. Since you originally followed the BFG documentation and used How you deal with this depends on what you are using BFG for and what you want to achieve. If you want sensitive or large files completely removed from the GitHub repo, then you need to contact GitHub support according to https://help.github.com/articles/remove-sensitive-data/ (emphasis mine):
In other words, GitHub Support might be able to provide further info on how you can discard the old history referenced by PRs. If you just want bulk removed from what default (non-mirror) clones see, then you don't have to worry about these, as they aren't fetched by default, but be aware that the size of the repo on GitHub will actually increase slightly as a result. |
Since this is a top search result for "deny updating a hidden ref", I figured I'd leave this here to help out the next person... If you've used BFG to clean up a repo, and you're trying to force push back to GitHub, make sure you're not trying to force push back to a protected branch. I wasted several hours staring at Buried deep in the If you're in the same boat, disable/delete branch protection, and try another
Note the familiar TL;DR — I could be totally mistaken, but the @rtyley perhaps something to clarify in future documentation? |
We faced the same problem described in this issue. We had an existent PR in our Repo, so we assume that was the root cause of the push rejection. Here's what we did (let's say that our repo was named
And we were able to successfully remove passwords from git history. Might not be the best solution for everyone, but in our case was enough. |
I think that I accidentally found a solution (I'm not sure I can explain why it works). Same thing, I had PRs (closed) on GitHub and
As far as I can tell, my repo in GitHub is now clean. Git pulling from my original repo doesn't work, but now I can easily delete that folder and clone a new copy. Any ideas for/against doing it this way? |
Mirror cloning from a local copy path apparently doesn't include pull request refs. This can be verified using |
How did you removed |
@avatar-lavventura that's exactly right, |
The error What I did to test bfg:
Result:
My explanation: For some reason, bfg not only had to change the commit IDs related to the first two steps, but also other ones (why?). The commit IDs of the other ones seem to contain file changes of files that are in closed PRs, but that doesn't bother me, because I only need to remove a file that wasn't part of a PR. Just wanted to add this: I don't believe you always need to delete PRs for a total clean-up. Sometimes, this message comes up as a side-effect of rewriting depending commits that are part of PRs. |
If you have any merged branches, it just looks like the push worked, which is the same as using
But if you delete the directory test and clone it again, you'll see that everything is back to the way it was. This only changes locally. It doesn't look like there's any difference between this command and
|
Hi,
I recently used BFG to remove some old files and change a few texts in my test files. The clean operations went all OK without a problem. When I tried to push the changes I had the following error message at the end:
{code}
error: failed to push some refs to '<MY_REPOSITORY>'
{code}
These are some of the rejected messages:
{code}
! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref)
! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (deny updating a hidden ref)
! [remote rejected] refs/pull/10/head -> refs/pull/10/head (deny updating a hidden ref)
! [remote rejected] refs/pull/10/merge -> refs/pull/10/merge (deny updating a hidden ref)
! [remote rejected] refs/pull/11/head -> refs/pull/11/head (deny updating a hidden ref)
{code}
Am I in trouble? Did I just mess up my repository? Is there anyway to correct this error?
I would really appreciate any help, thanks.
The text was updated successfully, but these errors were encountered: