thathoff / kirby-git-content

Commit and Push changes made via the Panel
MIT License
137 stars 20 forks source link

Error after installing (Kirby 3) with PHP < 7.3 #53

Closed malvese closed 3 years ago

malvese commented 5 years ago

The error message when I save a page is:

Exception: undefined
Call to a member function name() on null

I use a custom public folder setup, as described here, but it shouldn't create any problem. I also tried to move the "content" folder to its default location, but no luck.

Edit: I tried to set it up with a fresh Starterkit and get this when I save a page:

Exception: Exception
Unable to update git: Array to string conversion
thathoff commented 5 years ago

Hi, can you give me some more information? You’re using v3.0.0-beta.1, right? Did you install the plugin with composer? Do you have any line and file numbers of the two errors above? Thank you!

Just a wild guess: Do you have an active user in the Kirby panel? It seems that the error happens when writing the commit massage and adding the users information as git author (which is the only part where the plugin calls a name() method on an object). In your case the user object seems to be empty/null.

malvese commented 5 years ago

Thank you for your reply! I'm indeed using v3.0.0-beta.1, installed with Composer. I don't have a line number to provide, these are the errors I get in the Panel when I try to save. I do have a user named "admin".

thathoff commented 5 years ago

Did you manage to find the error in the last couple of days? I’m back from vacations so if you manage to get it working do you want to share the solution? Otherwise: Is it possible to get access to your installation / code?

malvese commented 5 years ago

I still get the same error. Do I need to set the remote? I'm trying to use the plugin locally via MAMP, and with the default options I think it should only try to commit, not push to the remote? I could share the code, but it really is just a fresh Starterkit, and the plugin installed with Composer as described in the Forum.

thathoff commented 5 years ago

I’ll try to test your starterkit setup tonight, maybe i’ll bee able to reproduce your error!

malvese commented 5 years ago

Any update on this? I just tried again and still can't get it to work. My setup is:

Every time I try to save, I get an error "Exception: Exception. Unable to update git: Array to string conversion". No change is commited. No PHP error in the console.

malvese commented 5 years ago

Update: I used PHP 7.1. I upgraded to 7.3 and the plugin now works. Is there a known minimum version that should be documented?

Also, I noticed I had to use a URL of the kind git@github.com:user/repo.git. I couldn't get past authentication with https://github.com/user/repo.git.

thathoff commented 5 years ago

Sorry for not replying, I totally forgot to replay to this issue! We will definitely have a look to support PHP 7.1, this should be the minimum required version. You might also want to switch from tag v3.0.0-beta.1 to dev-kirby3 for now because this branch already contains some small fixes.

malvese commented 5 years ago

Sweet! Thank you. I switched to dev-kirby3. You should really update the readme with all the info from the forum, it would help a lot.

FYI, I tried both 7.1 and 7.2 with dev-kirby3 and got the same error as before. For me it only works with PHP 7.3.

thathoff commented 5 years ago

We’ll try! :) Actually I’m waiting for feedback from Wottpal (who forked this plugin) if we should join forces on a Kirby git plugin. But have not heard from him for a couple of weeks. Because of this currently we're just doing very little development on our plugin so that we do not have to do things twice.

robinscholz commented 5 years ago

Currently running into a similiar error

Unable to update git: fatal: could not read Username for 'https://github.com': Device not configured

A properly working version of this would be amazing!

thathoff commented 5 years ago

@robinscholz This seems not to be related to this issue. It seems to me that the user running your web server does not have credentials to push to the remote repository.

malvese commented 5 years ago

Could it be related to this?

Also, I noticed I had to use a URL of the kind git@github.com:user/repo.git. I couldn't get past authentication with https://github.com/user/repo.git.

robinscholz commented 5 years ago

@robinscholz This seems not to be related to this issue. It seems to me that the user running your web server does not have credentials to push to the remote repository.

@thathoff This happens locally, while running kirby via valet. Any idea how to solve this?

thathoff commented 5 years ago

Hmm, we do everything with docker here, so I don’t know the details how valet works. Does valet run the code as the local user or as an nginx user? In the latter case you might want to sudo -i -u THE_NGINX_USER and try to clone the repository as that user.

robinscholz commented 5 years ago

Seems to be a valet problem: https://github.com/laravel/valet/issues/293

Running the plugin on a localhost server with php -S seems to be working. I'll try and figure out how to solve this once I have some more time.

robinscholz commented 5 years ago

Not entirely sure if this was the final fix, but adding my SSH Key to the mac keychain seemed to have worked: https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent

foxacid commented 5 years ago

Glad I found this. I was also getting the array to string conversion error:

Exception: Exception
Unable to update git: Array to string conversion

Upgrading to PHP 7.3 did the trick. Now on to making this work on the remote server...

thathoff commented 3 years ago

Since PHP versions < 7.3 are EOL i’ll close this issue.