Giter VIP home page Giter VIP logo

Comments (31)

akaguny avatar akaguny commented on May 19, 2024 15

in work with github i see the same errors (clean with -rt flag):

 ! [remote rejected] refs/pull/8/head -> refs/pull/8/head (deny updating a hidden ref)
error: failed to push some refs to '[email protected]:***/***.git'

from bfg-repo-cleaner.

harrylincoln avatar harrylincoln commented on May 19, 2024 5

Because I had never pushed to the origin before, you need to set it with the push, so...

git push -u origin master

More: refs issue

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024 4

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.

from bfg-repo-cleaner.

Wind010 avatar Wind010 commented on May 19, 2024 2

After removing the pull request references in my local mirror, I was able to push up to remote:
https://stackoverflow.com/questions/47776357/git-push-mirror-without-pull-refs

Luckily it was a new repository and only one PR.

from bfg-repo-cleaner.

rtyley avatar rtyley commented on May 19, 2024 1

Are you sure you cloned with --mirror? Could you repeat the steps just to be sure?

http://rtyley.github.io/bfg-repo-cleaner/#usage

from bfg-repo-cleaner.

rtyley avatar rtyley commented on May 19, 2024 1

Yup - use either that or the SSH url. The generic git protocol you're using
is not passing any authentication credentials, so GitHub is obviously not
going to accept pushes to your repo!
On 10 May 2014 23:44, "Biswajit Dutta Baruah" [email protected]
wrote:

Does that mean that I have to clone like this:

git clone --mirror https://github.com/orthodoc/my.git


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-42756652
.

from bfg-repo-cleaner.

cuococarlos avatar cuococarlos commented on May 19, 2024 1

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.

from bfg-repo-cleaner.

rtyley avatar rtyley commented on May 19, 2024

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 receive.denyNonFastForwards true set in it's config?

from bfg-repo-cleaner.

nick-youngblut avatar nick-youngblut commented on May 19, 2024

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.

from bfg-repo-cleaner.

nick-youngblut avatar nick-youngblut commented on May 19, 2024

I repeated twice before I posted the original comment. The commands in my original comment pasted from my history (with file names changed).

from bfg-repo-cleaner.

orthodoc avatar orthodoc commented on May 19, 2024

I was unable to do a git push after deleting a file. I got the following error:

fatal: remote error: 
  You can't push to git://github.com/orthodoc/my.git
  Use https://github.com/orthodoc/my.git

I did use the --mirror flag when cloning

from bfg-repo-cleaner.

rtyley avatar rtyley commented on May 19, 2024

You cloned using a read-only url. This is why you couldn't push your
updated history back.

https://help.github.com/articles/which-remote-url-should-i-use
On 10 May 2014 23:31, "Biswajit Dutta Baruah" [email protected]
wrote:

I was unable to do a git push after deleting a file. I got the following
error:

fatal: remote error:
You can't push to git://github.com/orthodoc/my.git
Use https://github.com/orthodoc/my.git

I did use the --mirror flag when cloning


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-42756358
.

from bfg-repo-cleaner.

orthodoc avatar orthodoc commented on May 19, 2024

Does that mean that I have to clone like this:

git clone --mirror https://github.com/orthodoc/my.git

from bfg-repo-cleaner.

orthodoc avatar orthodoc commented on May 19, 2024

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.

from bfg-repo-cleaner.

nishatafshan avatar nishatafshan commented on May 19, 2024

Hi,
I am facing similar issue. I have cloned using ssh url.
git clone --mirror ssh://git@server/repo.git

java -jar bfg-1.12.8.jar --strip-blobs-bigger-than 100M repo.git
cd repo.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive

Above steps cleans my repo.git from 6.4G to 1.2G. Later I try to push.
git push

But I get below error:-
Counting objects: 217307, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (80946/80946), done.
Writing objects: 100% (214361/214361), 666.42 MiB | 1.15 MiB/s, done.
Total 214361 (delta 118358), reused 209184 (delta 114750)
remote: You are attempting to update refs that are reserved for Stash's pull request
remote: functionality. Stash manages these refs automatically, and they may not be
remote: updated by users.
remote:
remote: Rejected refs:
remote: refs/pull-requests/190/from
remote: refs/pull-requests/247/from
remote: refs/pull-requests/247/merge
To ssh://git@server/repo.git
! [remote rejected] Branch -> Branch (pre-receive hook declined)
...
error: failed to push some refs to 'ssh://git@server/repo.git'

How should i fix it. Should I try with https url?

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024

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.

from bfg-repo-cleaner.

nishatafshan avatar nishatafshan commented on May 19, 2024

@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

from bfg-repo-cleaner.

nishatafshan avatar nishatafshan commented on May 19, 2024

@javabrett @rtyley Would you have any ideas on how to resolve below issue.

Post cleanup when I try push I am getting below error:-
Counting objects: 218648, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (81662/81662), done.
Writing objects: 100% (215818/215818), 666.89 MiB | 1.07 MiB/s, done.
Total 215818 (delta 119117), reused 210562 (delta 115381)
remote: Communication breakdown with Stash.
To ssh://repo.git
! [remote rejected] Branch ->Branch (pre-receive hook declined)
! [remote rejected] CUC-112 -> CUC-112 (pre-receive hook declined)
...
error: failed to push some refs to 'ssh://repo.git'

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024

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.

from bfg-repo-cleaner.

nishatafshan avatar nishatafshan commented on May 19, 2024

@javabrett there are no explicit hooks set in stash for the repo. How do I find pull more details to judge the cause?

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024

I recommend:

  • web search of that error message and go through the list of possible causes
  • checking the Stash server logs
  • contacting Atlassian support

from bfg-repo-cleaner.

trvinh avatar trvinh commented on May 19, 2024

in work with github i see the same errors (clean with -rt flag):

 ! [remote rejected] refs/pull/8/head -> refs/pull/8/head (deny updating a hidden ref)
error: failed to push some refs to '[email protected]:***/***.git'

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:

>git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
>git reflog expire --expire=now --all
>git gc --prune=now --aggressive
>git push

Then I got the same errors as @akaguny:

Counting objects: 7641, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3731/3731), done.
Writing objects: 100% (7641/7641), 56.76 MiB | 16.46 MiB/s, done.
Total 7641 (delta 3812), reused 7641 (delta 3812)
remote: Resolving deltas: 100% (3812/3812), done.
To https://github.com/abc/???.git
 + bef1e57...12792c1 bioconductor -> bioconductor (forced update)
 + 2504b81...ecb033d gh-pages -> gh-pages (forced update)
 + 4365d3b...43a7c82 master -> master (forced update)
 + 2eac6e7...346947d v0.1.0 -> v0.1.0 (forced update)
 + 4b2eca8...e522f0d v0.1.1-beta -> v0.1.1-beta (forced update)
 + d61480b...51034ad v0.2.0 -> v0.2.0 (forced update)
 + e5e5a97...e8b889d v0.2.1 -> v0.2.1 (forced update)
 + 29bca00...4709246 v0.3.0 -> v0.3.0 (forced update)
 + a53becf...ff9fa7b v0.3.1 -> v0.3.1 (forced update)
 + 135edb8...f734108 v0.3.2 -> v0.3.2 (forced update)
 ! [remote rejected] refs/pull/12/head -> refs/pull/12/head (deny updating a hidden ref)
 ! [remote rejected] refs/pull/17/head -> refs/pull/17/head (deny updating a hidden ref)
...
 ! [remote rejected] refs/pull/95/head -> refs/pull/95/head (deny updating a hidden ref)
error: failed to push some refs to 'https://github.com/abc/???.git'

Does anyone know the solution?
Many thanks!!

from bfg-repo-cleaner.

trvinh avatar trvinh commented on May 19, 2024

thanks so much @javabrett. I will try to contact them.

from bfg-repo-cleaner.

RWOverdijk avatar RWOverdijk commented on May 19, 2024

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.

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024

@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 refs/pull/ namespace in GitHub is read-only, and will retain old, pre-rewrite history, and block you from pushing new history.

from bfg-repo-cleaner.

RWOverdijk avatar RWOverdijk commented on May 19, 2024

I did do that, but using push --force made github yield to my bidding.

from bfg-repo-cleaner.

javabrett avatar javabrett commented on May 19, 2024

Interesting. Perhaps GitHub opened this up? To confirm beyond doubt you'd need to:

  • have a GitHub repo with Pull Requests with history that will be rewritten
  • clone the repo in a way that ensures those PR branches are cloned
  • note head commit on some PR
  • run BFG and check that the PR commit hash changed
  • force push back to GItHub
  • check that the PR on GitHub has the new history, and that old history can't be referenced through the PR(s).

In my recollection, PRs were always read-only, so this would fail without contacting GitHub support and asking for PRs to be dropped.

from bfg-repo-cleaner.

RWOverdijk avatar RWOverdijk commented on May 19, 2024

Ah, no I don't do this through a PR. I force push to master. I may have missed that part 😅

from bfg-repo-cleaner.

jerrylogansquare avatar jerrylogansquare commented on May 19, 2024

I had this issue with bitbucket, I went into the repo settings and turned this on:

Allow rewriting branch history

whalla

from bfg-repo-cleaner.

hpsaturn avatar hpsaturn commented on May 19, 2024

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.

from bfg-repo-cleaner.

markfaine avatar markfaine commented on May 19, 2024

@cuococarlos Did you ever figure this out? I'm having the same issue with Gitlab.

from bfg-repo-cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.