trilbymedia / grav-plugin-git-sync

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

'origin' does not appear to be a git repository - after update to v2.3.0 #199

Closed sebastianbaumann closed 3 years ago

sebastianbaumann commented 3 years ago

Bildschirmfoto 2021-04-29 um 15 50 47

Popup says everything is fine, but grav.log shows the following:

[2021-04-29 13:43:03] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' config core.sparsecheckout true 2>&1 [] []
  [2021-04-29 13:43:03] grav.NOTICE: gitsync[output]:  [] []
  [2021-04-29 13:43:04] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' config user.name "GitSync" 2>&1 [] []
  [2021-04-29 13:43:04] grav.NOTICE: gitsync[output]:  [] []
  [2021-04-29 13:43:04] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' config user.email "git-sync@trilby.media" 2>&1 [] []
  [2021-04-29 13:43:04] grav.NOTICE: gitsync[output]:  [] []
  [2021-04-29 13:43:04] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' config --unset core.sshCommand 2>&1 [] []
  [2021-04-29 13:43:05] grav.NOTICE: gitsync[output]:  [] []
  [2021-04-29 13:43:05] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote get-url "origin" 2>&1 [] []
  [2021-04-29 13:43:05] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []
  [2021-04-29 13:43:05] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote set-url origin "https://scm.xxx.com/grav/abc/abc-grav-pages.git" 2>&1 [] []
  [2021-04-29 13:43:06] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []
  [2021-04-29 13:43:06] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' status pages 2>&1 [] []
  [2021-04-29 13:43:06] grav.NOTICE: gitsync[output]: On branch master nothing to commit, working tree clean [] []
  [2021-04-29 13:43:06] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote get-url "origin" 2>&1 [] []
  [2021-04-29 13:43:07] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []
  [2021-04-29 13:43:07] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote set-url origin "https://gitlab-sync:{password}@scm.xxx.com/grav/abc/abc-grav-pages.git" 2>&1 [] []
  [2021-04-29 13:43:07] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []
  [2021-04-29 13:43:07] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' fetch origin master 2>&1 [] []
  [2021-04-29 13:43:08] grav.NOTICE: gitsync[output]: fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. [] []
  [2021-04-29 13:43:08] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' pull --allow-unrelated-histories -X theirs origin master 2>&1 [] []
  [2021-04-29 13:43:08] grav.NOTICE: gitsync[output]: fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. [] []
  [2021-04-29 13:43:08] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' push origin master:master 2>&1 [] []
  [2021-04-29 13:43:08] grav.NOTICE: gitsync[output]: fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. [] []
  [2021-04-29 13:43:09] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote get-url "origin" 2>&1 [] []
  [2021-04-29 13:43:09] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []
  [2021-04-29 13:43:09] grav.NOTICE: gitsync[command]: LC_ALL=C git -C '/var/www/vhosts/xxx.com/abc.xxx.com/user/' remote set-url origin "https://scm.xxx.com/grav/abc/abc-grav-pages.git" 2>&1 [] []
  [2021-04-29 13:43:09] grav.NOTICE: gitsync[output]: fatal: No such remote 'origin' [] []

Double checked if access rights for git-sync user are working and repo is definitely accessible. Checked with different repos, always got the same error in the logs, while popup suggests everything is working fine.

This is my git-sync-config:

enabled: true
folders:
  - pages
sync:
  on_save: false
  on_delete: false
  on_media: false
  cron_enable: false
  cron_at: '0 12,23 * * *'
local_repository: null
repository: 'https://scm.xxx.com/grav/abc/abc-grav-pages.git'
no_user: '0'
user: gitlab-sync
password: gitsync-defxxx
webhook: /_git-sync-14507bc689ff
webhook_enabled: '1'
webhook_secret: xxxx
branch: master
remote:
  name: origin
  branch: master
git:
  author: gituser
  message: '(Grav GitSync) Automatic Commit'
  name: GitSync
  email: git-sync@trilby.media
  bin: git
  ignore: null
  private_key: null
logging: true
w00fz commented 3 years ago

I see nothing wrong with your log, it should work. Wonder if perhaps this has to do with the update to the crypto library I did.

Could you try retyping your password in the password field, save and try again?

Also did you try manually running git fetch origin master from the user folder in terminal to see if that gives the same error?

sebastianbaumann commented 3 years ago

I already noticed that sometimes it looked like the password wasn't stored correctly. I tried to reenter the password multiple times, but nothing changed.

I'm afraid I can't test this as the site is setup on a shared PLESK multihost and I only have FTP access for now.

w00fz commented 3 years ago

@sebastianbaumann In #200 it was brought up an issue with the test repository and some other issue I introduced with the latest release.

Try updating to latest (v2.3.1) and go through the wizard, input your user/pass, go to step 2 and test the connection again. See if it passes. If it does, you should be able to properly synchronize now.