datopian / flowershow

💐 Publish your obsidian digital garden or any markdown site easily and elegantly.
https://flowershow.app/
MIT License
750 stars 92 forks source link

Make this a github template repo (even though it had lfs files at some point) #523

Closed rufuspollock closed 8 months ago

rufuspollock commented 1 year ago

We want it to be easy to clone this repo as a template so that people can use from obsidian plugin etc.

This requires purging git lfs from our history

Tasks

rufuspollock commented 8 months ago

Had a try today and other less destructive options e.g.

git lfs migrate export --everything --include="*"

And force pushing ... but no luck. (it worked to rewrite but after i pushed i still had the greyed checkbox)

Note that just pushing head did work ...

rufuspollock commented 8 months ago

@davidgasquez any ideas how to fix this 😄

davidgasquez commented 8 months ago

Woah, no clue to be honest. Mind sharing some extra context on the error you're facing? Happy to dig a bit and explore the error/issue.

olayway commented 8 months ago

@davidgasquez I think I just fixed this! Wanted to give you some context and paste the error Rufus was getting with git lfs migrate export but it just worked for me :) I'll try to convert the repo to a gh template now and I'll let you know if I have any issues.

davidgasquez commented 8 months ago

Sweet! The good ol "trying again the same stuff until it works". :joy:

olayway commented 8 months ago

@davidgasquez

Sweet! The good ol "trying again the same stuff until it works".

Unless it doesn't 🤣 Or at least not quite... There are still a bunch of historical files that seem to be blocking the repository conversion to a gh template.

The output of git lfs ls-files --all:

d8a28a47c4 * public/_flowershow/avatarplaceholder.png
6a87909da7 - examples/wordpress-to-flowershow/content/assets/hexagonal.pdf
82bc7cbe26 - examples/wordpress-to-flowershow/content/assets/images/154d6-img_4-min.png
c9e539e3ec - examples/wordpress-to-flowershow/content/assets/images/70eac-img_5-min.png
13032424f2 - examples/wordpress-to-flowershow/content/assets/images/f6f81-img_2-min.png
f1d1e57128 - obsidian_vs_flowershow.png
f00534ab6f - packages/markdowndb/__mocks__/content/assets/datopian-logo.png
ad91dedc79 - packages/remark-wiki-link/test/fixtures/content/assets/Pasted Image 123.png
41401a053d - site/content/assets/Pasted image 20220529083024.png
4d32127c06 - site/content/assets/Pasted image 20220529083217.png
7029d96134 - site/content/assets/Pasted image 20220529084433.png

...

8decc85719 - site/content/assets/sample.pdf
59a9ce0d8c - site/content/assets/images/blog.png
86144522ce - site/content/assets/images/site-wide-toc.png
85f6572958 - site/content/assets/images/content_folder.png
83d283c18d - site/content/assets/images/npx_build.png
fd681bef65 - site/content/assets/images/npx_create.png
0d02c5a1b2 - site/content/assets/images/npx_publish.png
ff98d748a2 - site/content/assets/images/npx.png

I've tried getting rid of them completely from the repo history with BFG Repo-Cleaner and filter-branch but with no luck... The switch is still disabled:

image
rufuspollock commented 8 months ago

@olayway i'd tried exactly this process with a fork of the repo and had the same experience - the checkmark still can't be ticked. (that was what i meant by "no luck").

BTW i'd recommend we try all this out on a fork before we change this repo - we don't want to accidentally lose stuff ... ( was working with a fork for all of this).

rufuspollock commented 8 months ago

OK, i've even tried force pushing a clean head branch (no lfs at all) to a fork of this repo and ... you still have the greyed out button. My guess is there are still files in github's lfs file storage. If you look at this page https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage

After you remove files from Git LFS, the Git LFS objects still exist on the remote storage and will continue to count toward your Git LFS storage quota.

To remove Git LFS objects from a repository, delete and recreate the repository. When you delete a repository, any associated issues, stars, and forks are also deleted. For more information, see "Deleting a repository." If you need to purge a removed object and you are unable to delete the repository, please contact support for help.

I'm going to now try and contact support to get files purged from this repo.

rufuspollock commented 8 months ago

NB: i've confirmed that running:

git lfs migrate export --everything --include="*"

And pushing to a clean repo (not a fork) works - i.e. template option is available.

Message to github support

Hi,

We want to turn our repository https://github.com/datopian/flowershow into a template repository.

However, we currently have the option greyed out:

image.png

This is true even though we have now purged all lfs files from the repo.

We suspect there is something at github's end that needs to happen, perhaps (?) removing all Git LFS storage files associated https://github.com/datopian/flowershow (we are happy for you to do this!)

We have this suspicion following instructions in https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage

To remove Git LFS objects from a repository, delete and recreate the repository. When you delete a repository, any associated issues, stars, and forks are also deleted. For more information, see "Deleting a repository." If you need to purge a removed object and you are unable to delete the repository, please contact support for help. [emphasis added]

Best,

Rufus Pollock

Background

More info in: https://github.com/datopian/flowershow/issues/523

We want to turn our repository https://github.com/datopian/flowershow into a template repository.

That requires removing all git lfs files.

We've done this running git lfs export etc and force pushing. However, the "make template repository" is still greyed out:

image.png

We've even tried force-pushing a clean "HEAD" of the repo (to a trial fork) and that did not work either.

What does work is:

  1. cloning the repo
  2. Running git lfs migrate export --everything --include="*"
  3. Pushing to a new clean repo (not a fork)
  4. At this point the option to make a template repo is available

This makes us suspect that there is something still around at the github end that indicates that datopian/flowershow is an "LFS" repo even though all lfs stuff is gone.

Reading the docs here:

https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage

We suspect we actually need to have the files purged from git lfs storage itself - which we are very happy to have happen (we only pushed a few asset files accidentally that we don't need anymore).

rufuspollock commented 8 months ago

OK. After various back and forth with github support got the final answer that this is not possible!

Hi ...

Thanks for your patience while we've looked into this.

I'm afraid I don't have good news for you. It would take quite a lot of complex work on our back end to allow a repo that used to use LFS to become a template, and it's not likely that work is going to be prioritized any time soon, sorry!

If you want the repository at datopian/flowershow to be a template you'll need to delete and recreate it, which I know is not ideal.

As a compromise you could create a new repository to act as the template and have that automatically sync with datopian/flowershow to keep it up to date, and advertise its existence from the datopian/flowershow README? Our Marketplace has a number of options for automatically mirroring repos.

Sorry that's not the answer you were hoping for! Please let me know if you need any further help.

Cheers,

rufuspollock commented 8 months ago

WONTFIX. The options remaining are ...