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
push denied after deleting files with bfg #41
Comments
Can you tell me who's hosting the remote Git server? GitHub, BitBucket, perhaps an internal corporate service? I think it's quite likely the remote server has been configured to reject non-fast-forward updates - meaning that it's disallowing history-rewriting! Does the remote have |
Sorry for not specifying that in my initial comment. I was trying to push to GitHub, so I'm guessing that history-rewriting is not the issue. |
Are you sure you cloned with |
I repeated twice before I posted the original comment. The commands in my original comment pasted from my history (with file names changed). |
I was unable to do a
I did use the --mirror flag when cloning |
You cloned using a read-only url. This is why you couldn't push your https://help.github.com/articles/which-remote-url-should-i-use
|
Does that mean that I have to clone like this:
|
Yup - use either that or the SSH url. The generic git protocol you're using
|
I did that. Successfully pushed the changes. Some refs failed to go through. Probably Issue #36 that you have already explained. I checked history of my repo and the its squeaky clean. bfg made my day. I can't thank you enough. |
Hi, java -jar bfg-1.12.8.jar --strip-blobs-bigger-than 100M repo.git Above steps cleans my repo.git from 6.4G to 1.2G. Later I try to push. But I get below error:- How should i fix it. Should I try with https url? |
The error message is fairly clear - Stash won't let you push refs under "pull-requests". There's a few things you could do, including renaming that branch in your local, making it non-tracking, deleting it etc. I don't know what the impact on clean-up will be in Stash if it is retaining those refs - maybe there is a clean-up process for those. |
@javabrett You are correct. I had to get rid of the pull requests. I got them merged / declined and then started with the bfg clean up steps. There is another way to get rid of pull request from mirror clone - http://christoph.ruegg.name/blog/git-howto-mirror-a-github-repository-without-pull-refs.html |
@javabrett @rtyley Would you have any ideas on how to resolve below issue. Post cleanup when I try push I am getting below error:- |
It looks like a hook, pre-receive hook, is declining the push, but may be doing-so silently. You need to establish why that hook is rejecting the pushes to those refs, which may involve making the hook output more-verbose. Perhaps those refs are locked/protected by Stash. |
@javabrett there are no explicit hooks set in stash for the repo. How do I find pull more details to judge the cause? |
I recommend:
|
in work with github i see the same errors (clean with -rt flag):
|
Hi @akaguny , what did you mean by "clean with -rt flag"? I am also trying to clean up my repository following the manual and then pushing it back into github using these commands:
Then I got the same errors as @akaguny:
Does anyone know the solution? |
If you need to delete Pull Requests (and their hidden branches) permanently (because they contain history you want to delete), you have to contact GitHub Support with that request. |
thanks so much @javabrett. I will try to contact them. |
Isn't this just simply because you rewrite history? After running these commands you have a completely different history (in the eyes of github for example). I had to force push because of it, but it makes sense to me. |
@RWOverdijk did you rewrite a repo cloned from GitHub, including pull-requests, and try and push that rewritten history back, to GitHub? That's what a lot of the issues in this issue relate to, and the topic of my comment. The |
I did do that, but using push --force made github yield to my bidding. |
Interesting. Perhaps GitHub opened this up? To confirm beyond doubt you'd need to:
In my recollection, PRs were always read-only, so this would fail without contacting GitHub support and asking for PRs to be dropped. |
Ah, no I don't do this through a PR. I force push to master. I may have missed that part 😅 |
Because I had never pushed to the origin before, you need to set it with the push, so...
More: refs issue |
I had this issue with bitbucket, I went into the repo settings and turned this on: Allow rewriting branch history whalla |
After removing the pull request references in my local mirror, I was able to push up to remote: Luckily it was a new repository and only one PR. |
With Gitlab I have the same issue, but the repo is cleaned, some branches and pull requests are lost. In Gitlab is imposible or they don't have a setting like "Allow rewriting branch history". Well it works, but you need keep in mine this with bfg. |
Hi, I have a same problem with Gitlab. I don't quite understand how Gitlab has been able to fix it. Any help would be appreciated. Sorry for my basic english. |
@cuococarlos Did you ever figure this out? I'm having the same issue with Gitlab. |
After deleting select files from my repo with bfg, I'm denied when using git push.
The commands that I used (repo name changed to protect the innocent):
git clone --mirror /path/to/my/repo.git
bfg -D file1 repo.git
bfg -D file2 repo.git
bfg -D file3 repo.git
cd repo.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push
The output from 'git push'
Counting objects: 857, done.
Delta compression using up to 40 threads.
Compressing objects: 100% (280/280), done.
Writing objects: 100% (817/817), 6.25 MiB, done.
Total 817 (delta 513), reused 803 (delta 503)
remote: error: denying non-fast-forward refs/heads/develop (you should pull first)
remote: error: denying non-fast-forward refs/heads/feature/align_breakpoints (you should pull first)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To /var/git/sharchaea/genome_align/
! [remote rejected] develop -> develop (non-fast-forward)
! [remote rejected] feature/align_breakpoints -> feature/align_breakpoints (non-fast-forward)
! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/var/git/sharchaea/genome_align/'
Any idea what's going on?
Thanks
The text was updated successfully, but these errors were encountered: