Closed thejoyhouse closed 7 years ago
Thought I fixed it myself but its still happening whether I have credentials in or not.
What do you mean by having credentials in? The plugin need your user/pass or token setup and it's a one time operation. After having stored those it's not required to put them again.
I'm getting this as well. On the command line you'd get this error if you called git add
on a file that you deleted. It needs to be git rm
to stage deleted files. Perhaps you are calling the git API in this way internally?
Which version of git are you running? I think add is sufficient after 1.7+, I can delete pages and it seems to work fine.
I'm running git version 2.10.1 (Apple Git-78)
@w00fz My server is running git 1.9.1. Is it possible for the PHP git API differ in version?
Anyway, I'll upgrade when I can and see if that solves it.
I have the same issue. When I delete a page on my live server or on my local dev and then do a sync on the Git Sync plugin page in the admin it shows this error in a red Grav error notification. Locally I have git version 2.11.0. I'm not sure which version I have on the live server, since I don't have the credentials to log-in.
To solve it locally I manually do a git rm path/to/page
and then click the sync button again in the admin. But for the live environment this is obviously not an option.
@redrohX @samwalls @thejoyhouse would git add --all
work as well instead of using git rm
?
Yes, git add --all
is a bit faster than manually adding everything with git rm
Any idea how i can solve this? It's still the same issue and I don't understand why nobody else has issues with this.
Deleted a page on my live environment in the Grav admin, but Git-Sync doesn't automatically sync when pages and content are deleted. It shows this error:
Your branch is up-to-date with 'origin/webstaging'.
Changes not staged for commit:
deleted: pages/02.blog/test-blog/blog-item.en.md
deleted: pages/02.blog/test/Dokter-ehealth-Hero_0000_IMG_8614 klein.jpg
deleted: pages/02.blog/test/MD_Dokter_ehealth-RdV0134 klein.jpg
deleted: pages/02.blog/test/MD_Dokter_ehealth-RdV0162.jpg
deleted: pages/02.blog/test/about.en.md
deleted: pages/02.blog/test/blog-item.en.md
no changes added to commit
The pages are deleted locally, but it doesn't sync the changes. Also every time I manually do a sync through the plugin interface in the admin it shows the above error.
Because it doesn't sync the deleted pages, my other environment doesn't have these pages removed. With a reset local copy
I get rid of the error notifications, but it puts these pages back again...
So how can I solve this or is this an issue/feature in git-sync? Can't git-sync handle deleted content?
I did some debugging and the bin/plugin git-sync sync
works without any issues as far as I can see. But when I press the sync
button in the admin, or delete a page and trigger a save it doesn't add the deleted content and shows the error I mentioned in my previous post.
Now what I think happens is that I run the CLI command on macOS, which has git version 2.1.0, but the git command that is run from the admin runs on my vagrant box, which has git version 1.9.1. Which is exactly the same version that we run on our staging and production servers. If I do a dump($this->git->add())
on line 103 in git-sync.php
it returns the following message:
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal’, whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'pages/02.blog/test/blog-item.en.md' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default, ignores paths you removed from your working tree.
* 'git add --all <pathspec>' will let you also record the removals.
Run 'git status' to check the paths you removed from your working tree.
Now there is a check in the add()
function to see if the git version is lower than 1.8.1.4 (line 155 in GitSync.php
), if so it adds --all
to git add
. But according to the feedback I get from the message this should be done for git versions below 2.0.
So when I manually remove the check or set it to 2.0 and delete my pages; it works as expected. The deleted files are added and it syncs the content to the repo. See also this Stackoverflow answer.
I've made a pull request to have this fixed. #49
Upgrading my git version using the latest version 2.13.0
through git's ppa solved this issue for me. I'd recommend merging @redrohX 's pull request
I merged this now, thanks!
When I try to delete a page I get the error: Deleting page failed on error: # On branch master # Changes not staged for commit: # (use "git add/rm ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # deleted: pages/05.services/default.md # no changes added to commit (use "git add" and/or "git commit -a").. and it isn't reflected in my Bitbucket repo afterwards. Is delete not implemented yet?