trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
240 stars 58 forks source link

Error after setup: FETCH_HEAD - Permission denied #155

Closed AeonSake closed 4 years ago

AeonSake commented 4 years ago

I've followed the instructions in the video as well as the setup wizard to setup the plugin. The repo is hosted on https://gitlab.com (private repo) and contains only the master branch with a README.md file. Connection as well as webhook are configured correctly.

After the setup or by pressing the 'Syncronize' button in the plugin interface, a red error banner at the top says: *From https://gitlab.com/my-repo branch master -> FETCH_HEAD fatal: unable to look up current user in the passwd file: Permission denied**

Testing the webhook/integration from the GitLab side results in the following error: Hook executed successfully but returned HTTP 500 {"status":"error","message":"GitSync failed to synchronize"}

I'm using a GitLab access token for the login/authentication which has the api scope enabled.

I've tried to completely wipe the plugin, including all config files and the .git directory, and reinstall it but the error keeps occurring.

What am I missing?

paulhibbitts commented 4 years ago

Hi @AeonSake , I've used Git Sync a bit with GitLab.. just to double-check have you made an initial commit in the repo before running Git Sync?

AeonSake commented 4 years ago

Thank you @paulhibbitts for your reply; yes, you are right. On the first install I forgot that GitLab creates repos without any content/branches. After that I assumed that it failed because of that (since there was no master branch to push to). I then removed the plugin and all its content, made an initial commit and tried again. Did I miss some temporary files or something during cleanup and the plugin now still assumes the old state?

I deleted the following files/directories (in that order) before re-installing the plugin:

Oh and another side note: I also used the webhook secret for setup

paulhibbitts commented 4 years ago

Did it work @AeonSake or are you still getting the error? I think to try again you would need to remove the /user/config/plugins/gitsync .yaml file created AND the (invisible) .git folder that was likely created in your /user folder and then try to re-run the Git Sync wizard - which I think should then automatically reappear when you view the Git Sync plugin options page in Admin.

AeonSake commented 4 years ago

I did all that. Removed the GitLab webhook. Re-installed the plugin. Redid the setup. Same error.

paulhibbitts commented 4 years ago

Can you confirm that no .git folder exists? Are you getting the Git Sync wizard?

AeonSake commented 4 years ago

Yes I got the wizard again. Same setup routine as before but also the same error.

paulhibbitts commented 4 years ago

Sorry, no more ideas... maybe someone else here might have an idea of what is going on?

paulhibbitts commented 4 years ago

Oh, maybe one more🙂 Perhaps also test with a GitHub repo?

AeonSake commented 4 years ago

It just seems strange to me. The error mentions a passwd file which is usually a UNIX file in the /etc directory for storing passwords. I don't see how that should be related to this plugin in any way.

AeonSake commented 4 years ago

@paulhibbitts I also tried a GitHub repo, same error.

paulhibbitts commented 4 years ago

Thought it was worth a shot🙂

w00fz commented 4 years ago

These are the most common issues:

  1. You used email instead of user for the username
  2. The token you created does not have enough permissions for the repository to access it (have you also tried with your password just for testing purposes?)
  3. Your git repo is not correct in Step 2. This is the format it should be looking like: https://gitlab.com/<your_user>/<your_repo>.git, note the https://gitlab.com/ part, no user@ and it's the https format, not git.
AeonSake commented 4 years ago

These are the most common issues:

  1. You used email instead of user for the username
  2. The token you created does not have enough permissions for the repository to access it (have you also tried with your password just for testing purposes?)
  3. Your git repo is not correct in Step 2. This is the format it should be looking like: https://gitlab.com/<your_user>/<your_repo>.git, note the https://gitlab.com/ part, no user@ and it's the https format, not git.
  1. I used my GitLab username (and also tried it with GitHub username)
  2. The token has all available permissions (same issue when using password instead)
  3. The URL of the git is correct

It appears to be a server-side issue which I can't figure out. I was hoping someone could explain the given error message so I could troubleshoot the server.

w00fz commented 4 years ago

unable to look up current user in the passwd file: Permission denied

Like you said above, this is not related to the plugin itself. However, the plugin does use the system git command and so if that has issues, it will proxy the error back to GitSync. Have you tried running any git command manually via terminal to see if you get the same problem? Also that error sounds like you need some chmod 644 /etc/passwd.

Sorry, this is all I can think of.

dvlprroshan commented 2 months ago

Having same issue error: cannot open '.git/FETCH_HEAD': Permission denied when using window with virtualbox in linux using network setup to sync the file between multiple machine. Also i provided the required permission in window but still not working!

is there any special way to provide permission to git in window machine.