Skip to content
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

Please don't trash repos on first run #213

Open
ndarilek opened this issue Feb 8, 2022 · 7 comments
Open

Please don't trash repos on first run #213

ndarilek opened this issue Feb 8, 2022 · 7 comments

Comments

@ndarilek
Copy link

ndarilek commented Feb 8, 2022

Here's my typical Grav workflow. Note that I'm fairly new to Grav, so maybe I'm doing something dumb:

  • Grab a grav skeletin and fetch out the user/ folder
  • Initialize it as a git repository.
  • Add a VS Code .devcontainer setup I've created for Grav.
  • Make changes until the site looks good.
  • Install the site into a hosting provider of my choice. I have a couple different versions of this right now--either Docker container or standard PHP hosting.
  • Install the git-sync plugin somewhere so the sites can sync.

And this is where all hell breaks loose. Grav proceeds to trash my git config, the biggest and most damaging change being converting the repo to a sparse checkout and trashing .gitignore.

Maybe there's some benefit to this, but I generally set up my repo the way I like and don't really appreciate this plugin trashing it. I wish there was a "just set up SSH/auth, pull and push" mode for folks like me who've already set up our repositories the way we want and don't need quite as much handholding. Maybe there is already and I just don't know it.

At the moment I'm dealing with the fact that I carefully set up my git repo, only for this plugin to trash its copy of the repo. This particular hosting environment is stuck on Git v2.20, so it doesn't have nice sparse checkout support. I've gone through a bunch of howtos on how to disable this, but git status shows no changes to the remote website repo, even though bunches of files including my theme/accounts are just plain missing. Thankfully, because this copy of git is so old, it hasn't yet trashed my remote repo. Now I'm considering installing the git-sync plugin locally, but that'll just install it on a smart copy of git with the power to break the repo locally and, potentially, push those broken changes to the remote.

Sorry if I seem cranky, but this bug has me genuinely frustrated. You've created an amazing power feature and basically strapped exploding training wheels on it. :) Is there some way to opt out of some of this advanced repo trashing? FWIW, I did jump through the hoops necessary to disable the sparse checkouts and a few other tweaks on another website and things seem to work, so to the best of my knowledge I'm not proposing shipping a tool with the safety off. I just don't think it should make a bunch of surprising changes to my repo, particularly in my dev environment. Reconfigure git with correct SSH paths, username and email? Fine. Monkeying with the checkout? Not so much.

Thanks.

@hughbris
Copy link
Contributor

hughbris commented Mar 3, 2022

I'm not a maintainer but I want to add that I understand your frustration.

This plugin seems to be setup for a very specific use case (it was developed for a client, I believe, so fair enough) and should come with warnings for anything else because it is potentially destructive (of uncommitted changes, anyway).

I'm so glad I read your comment before trying this on an existing repository. I made a file backup because not all of my local changes to that repo were staged yet.

I read through the code and it seems quite zealous.

I've decided I'm looking for something a little different for my content editors. I really want them to be able to review their changes and then commit them locally (and ideally keep them away from awful Git terminology!). I don't know so much about Git Hooks, but I am under the impression I can set them up and they will take care of the rest of the deployment workflow. No need to set up remotes via the plugin.

Perhaps this should have been put into Discussions here. I've made a clone and started greatly simplifying it for my purposes and this may end up as a new plugin. There are other (not abandoned) Git libraries too and not all require PHP exec, so gonna try them out. I am grateful to this plugin for the starting point. I am out of time now. I will share it as a simpler and safer alternative plugin if it becomes releasable.

Anyway, I think my TLDR is that the README should include more warnings about suitable and risky use cases.

@ndarilek
Copy link
Author

ndarilek commented Mar 4, 2022 via email

@hughbris
Copy link
Contributor

@ndarilek thanks for your patience. Docs probably need a review in light of recent development and are still patchy in parts, but happy to answer questions you might have: https://github.com/hughbris/grav-plugin-pushy

@Sogl
Copy link

Sogl commented Jul 23, 2022

+100

The first time I tried to use this plugin was a few years ago and it sent me automatic changes that I then recommitted. Removed.

Today I try again. Again automatic commits, git reset --hard, loss of a bunch of local folders, files, nerves. It's good that I pre-packed my folder into a zip. Several attempts to reset everything and I did as it was before this plugin.

The saddest thing is that in my case, it rewrote my .gitignore, and then auto-committed all .DS_Store in each of the folders (gitignor-ed before). Madness.

I just want to push/pull changes in the /pages folder to git (localhost and production sites) through the Admin WHEN I WANT TO.

P.S. While I was writing this comment and saving the plugin configuration, I again got an auto-commit with DS_Store. I didn't send anything, all options are off. It's just impossible.

image

P.P.S. It also changed my .git/config:


[user]
	name = GitSync
	email = git-sync@trilby.media

but this is only needed with githook, because now when I try to commit in normal way, I see this name in my git app:
image

Plus sparsecheckout = true option that I don't need at all... only gave problems with normal commits

@hdwebpros
Copy link

I do the following

  • develop the site local. Get it to a point where it should be on a staging server
  • Move the site to a staging server
  • Install Git Sync
    After install, I get

error: bad index file sha1 signature fatal: index file corrupt

Every time.

@hughbris
Copy link
Contributor

error: bad index file sha1 signature fatal: index file corrupt

This seems like a valid issue but also does not seem related to this one (as far as I can see, anyway).

@FravBox
Copy link

FravBox commented Mar 24, 2023

Used this plugin for the first time a couple days ago.
It very unexpectedly trashed everything and completely broke my site.

Yes, please, change this.
It ruined my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants