Giter Club home page Giter Club logo

kirby-git-content's People

Contributors

che1ron avatar cstmth avatar graphichavoc avatar jake avatar lukasbestle avatar pascalmh avatar qwerdee avatar radibit avatar s3ththompson avatar thathoff avatar therephil avatar tobiastom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kirby-git-content's Issues

Is it normal to end up with all sorts of uncommitted `.lock` file deletes?

When I modify a page in the panel a click save, the changes are correctly pushed to the content repo, but I don't end up with completely clean repo locally: there are changes not staged for commit. For example, this is what I have now after modifying my sample-page:

$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	deleted:    2_sample-page/.lock

no changes added to commit (use "git add" and/or "git commit -a")

Is this normal? Can I ignore this? Or should I be worried that this dirty repo might prevent a commit from going through somewhere down the line?

Not too sure what to think…

Only add files of changed page

Currently all changes in the content folder are added. It might increase performance on large repositories when only the content folder of the changed page is added.

plugin doesn't load with kirby 3.5.6

attempted to upgrade our site to kirby 3.5.6 (from 3.5.2) and am running into this error with this plugin:
image
it's been very useful so we'd hate to lose it

Commits don't include Kirby Panel user as author

Heya, I ran into an issue where the git commits didn't contain the Kirby Panel user's name and email address. Stirred the code a bit, and turns out $this->kirby->user() was null when declaring $user. Replacing $user = $this->kirby->user(); with $user = kirby()->user(); in KirbyGitHelper.php#L107 seemingly fixed this issue (on my Kirby 3.4.2 install at least). ✨ I'm way too amateur to see why the og line didn't work, as $this->kirby works nicely elsewhere in the code. Anyway, I guess this is a heads-up, idk if anyone else had this problem. 👀

$user = $this->kirby->user();

Working fine locally but not committing when on public server

I have the plugin working brilliantly on my local machine. However, when I make a change on the live site, no commit occurs.

My config:

    'thathoff' => [
        'git-content' => [
            'commit' => true,
            'push'=> true,
        ],
    ],

My steps

  1. Edit a page in the panel and click Save.
  2. Run git status and/or git log via ssh from content folder.
    Expected: Change has been committed, working directory is clean.
    Actual: Changes are visible but have not been staged or uncommitted.

What I know about the server setup

  • git 2.17.1 is installed
  • composer install has been run, and all plugin files and vendor packages are there
  • git status accurately reflects site changes
  • content repo is on master branch
  • git commands work fine if done directly via command line
  • remote origin is Github. SSH keys have been properly set up so that I am able to push to and pull from the server to Github without issues
  • Error logs don't show anything, and no error messages appear when saving

Other notes

  • Local environment works fine, uses PHP 8.1.3
  • My content folder is in the normal place
  • I have my content repo set up as a submodule (all git commands work as expected inside of it and point to the right remote)

Kirby Status

Debugging: on
PHP: 7.4.25
Server: Apache

Any thoughts?

Array to string conversion error with Kirby 3.6 and PHP 8.0

Hi there,

after updating to Kirby 3.6, I’ve been running into an array to string conversion error upon saving a page in the panel and thus creating a new commit. I've found this issue which may or may not be related, but for me, the error only appeared after updating to Kirby 3.6 and PHP 8.0 on my production server. Git logs tell me that the changes are not staged for commit. Manually committing and pushing to the repository works fine.

Screenshot 2022-02-11 at 12 34 29

Fixes I’ve tried:

  • the error persists over multiple user accounts, all with a valid email and full name
  • I’ve tried setting a custom (empty) commit message or adding a custom string for the author in src/KirbyGitHelper.php, but no luck

If anyone else has run into this errors or has any idea how to fix, I’d be very grateful. This plugin is proving incredibly helpful across a range of my projects, so I’d love to fix this soon. Thanks!

Working locally but not on server

Locally the plugin works as expected.

On the server, it does not seem to be installed (but it is). The "Git Content" item in the dropdown menu is not there. I have displayErrors set to true.

Any troubleshooting tips?

Use git lfs for files

As the git repository can get quite big when images etc. are uploaded it might make sense to use the git lfs extension for those files

Not working when `site.txt` is changed

Maybe Kirby doesn't fire any hooks for the site-settings or what else could be the problem? And when I save any other page after I've modified site.txt (via Menu > Settings) it commits & pushes all changes together.

bildschirmfoto 2017-08-19 um 12 36 17

Dennis

ssh: Could not resolve hostname github.com: Name or service not known

I have setup ssh keys for my github repository and ssh -T [email protected] works, however, I'm getting the following error when I make a GET request at the /gcapc/push endpoint.

2016/07/07 22:40:54 [error] 44#44: *63 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'Exception' with message 'ssh: Could not resolve hostname github.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
' in /pigeon-website/site/plugins/git-commit-and-push-content/Git.php/Git.php:317
Stack trace:
#0 /pigeon-website/site/plugins/git-commit-and-push-content/Git.php/Git.php(332): GitRepo->run_command('/usr/bin/git pu...')
#1 /pigeon-website/site/plugins/git-commit-and-push-content/Git.php/Git.php(627): GitRepo->run('push --tags ori...')
#2 /pigeon-website/site/plugins/git-commit-and-push-content/helpers.php(64): GitRepo->push('origin', 'master')
#3 /pigeon-website/site/plugins/git-commit-and-push-content/git-commit-and-push-content.php(80): KirbyGitHelper->push()
#4 [internal function]: Kirby->{closure}('push')
#5 /pigeon-website/kirby/toolkit/helpers.php(270): call_user_func_array(Object(Closure), Array)
#6 /pigeon-website/kirby/kirby.php" while reading response header from upstream, client: 10.0.2.2, server: _, request: "GET /gcapc/push HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "localhost:8005"
10.0.2.2 - - [07/Jul/2016:22:40:54 +0000] "GET /gcapc/push HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"

If it helps here is the output of git config --list:

user.name=pigeonmed
user.email=<my_email_address>
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
[email protected]:pigeonmed/pigeon-website.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
submodule.git-commit-and-push-content.url=https://github.com/pigeonmed/kirby-git-commit-and-push-content.git
root@8695cdc269c4:/pigeon-website# git remote -v
origin  [email protected]:pigeonmed/pigeon-website.git (fetch)
origin  [email protected]:pigeonmed/pigeon-website.git (push)

I figure this is probably a configuration issue on my end but I have yet to track it down. Have you seen anything like this before?

Authentication failed for git

my project coned fine by command:
git clone http://root@local-ip/root/project.git

but when i want to push it i get this error:
fatal: Authentication failed for 'http://root@local-ip/root/project.git/'
(i type correct password for user root and ssh root@local-ip work fine!)

my git config inside in cloned project its:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = http://root@local-ip/root/project.git
fetch = +refs/heads/:refs/remotes/origin/
[branch "master"]
remote = origin
merge = refs/heads/master

please someone with git knowledge help me

Including user files?

So far gcapc only watches files in the content folder. Do you plan to include the user folder as well someday?
The reason is that sometimes content in user pages is used in a site, like photos and bios in an "about" page, so for visitors they are part of the site's content.
In K3 passwords are stored in a separate file that can be ignored by Git, so it is no longer dangerous to version users.

Use of functions deprecated in Kirby v4

Hi, I updated one of my websites to Kirby 4 and get this error when saving files, presumingly caused by git-content:

The internal $model->contentFileDirectory() method has been deprecated. Please let us know via a GitHub issue if you need this method and tell us your use case.

Editing helpers.php

Hey, Just had a quick question.

I just followed the install guide, and have a separate repo made for content. I'm pushing that repo, and the main repo to the same VPS, do you have any tips on how I can get this working on my VPS? Do I need to edit the helpers.php file to specify where my repos are?

My current repos are private and are located here: https://github.com/johnchourajr/grandfb-content

Here is my current helpers.php file content.

<?php

require_once('Git.php/Git.php');

/**
 * Compose Commit message, appends " by Username"
 *
 * @param string $commitMessage
 *
 * @return false
 */
function gitCommit($commitMessage)
{
    $debugMode = c::get('debug', false);
    $branch = c::get('gcapc-branch', 'dev');
    $pull = c::get('gcapc-pull', true);
    $push = c::get('gcapc-push', true);
    $commit = c::get('gcapc-commit', true);
    $gitBin = c::get('gcapc-gitBin', '/../grandfb-content/');
    $windowsMode = c::get('gcapc-windowsMode', false);
    /*
     * Setup git environment
     */
    if ($windowsMode) {
        Git::windows_mode();
    }
    if ($gitBin) {
        Git::set_bin($gitBin);
    }

    $repo = Git::open('../content');

    if ($debugMode) {
        if (!$repo->test_git()) {
            echo 'git could not be found or is not working properly. ' . Git::get_bin();
            exit;
        }

        if (!Git::is_repo($repo)) {
            echo '$repo is not an instance of GitRepo';
            exit;
        }
    }

    /*
     * Git Pull, Commit and Push
     */
    if ($pull) {
        $repo->checkout($branch);
        $repo->pull('origin', $branch);
    }
    if ($commit) {
        $repo->add('.');
        $repo->commit($commitMessage . ' by ' . site()->user());
    }
    if ($push) {
        $repo->push('origin', $branch);
    }

    return false;
}

Error with checking existence of Git.php submodule

This commit introduced an error for me. I resolved it by changing the initRepo check it adds to use __DIR__ and DS instead of hardcoded relative paths.

if (file_exists(__DIR__ . DS . 'Git.php' . DS. 'Git.php')) {
    require __DIR__ . DS . 'Git.php' . DS. 'Git.php';
} else {
    require kirby()->roots()->index() .
    DS . 'vendor' . DS . 'pascalmh' . DS . 'git.php' . DS . 'Git.php';
}

Add a panel button to push to remote

Hey!

I am helping a friend with their Kirby website and I’d like to enable them (non-tech person) to get the content backed up on git. I think this plugin is perfect for that (I was doing commits once in a while from SSH), but their hosting plan doesn’t offer cron job integration. The content is a lot of images, so doing commits after each change to /content folder sounds slow. But if the cron job would simply trigger an endpoint, would it be a lot of work for me to add a button in the panel that triggers the push? So the friend could simply run it once a week / once in a month or after they are done with a bunch of changes.

Thanks!

Install as git submodule

Hi

Are you planning to make this plugin installable as a git submodule like other Kirby plugins do?

The way I've got my multisite folders and git repos set up it would be great if I could do that with this plugin too.

Many thanks :)

plugin possibly causes internal server errors with certain characters

attempting to push these blocks:

{
        "content": {
            "location": "kirby",
            "image": [
                "projects-directory.png"
            ],
            "src": "",
            "alt": "",
            "caption": "",
            "link": "",
            "ratio": "",
            "crop": "false"
        },
        "id": "c35ed1a4-7b00-46ff-a08f-1bf603c54b55",
        "isHidden": false,
        "type": "image"
    },
    {
        "content": {
            "text": "<p><strong>On MAC OSX:</strong></p>"
        },
        "id": "a54d7a27-8010-4502-972e-0612f3f4013d",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>/Users/xxx/Library/ApplicationSupport/Quantitative Imaging/QiTissue/QiProjects<br></p>"
        },
        "id": "9c12b731-9a3b-464e-a370-e2668a6c379c",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><strong>On Windows:</strong></p>"
        },
        "id": "30baddfe-3184-4f2e-982a-bd843c7aa1ea",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>C:\\Users\\xxx\\AppData\\Local\\Quantitative Imaging\\QiTissue\\Projects</p>"
        },
        "id": "5f487941-712d-4e75-a4e3-af5bab0736f0",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>Contains:</p>"
        },
        "id": "1da6b4c1-2ab1-40c1-b670-dcb455ac5ddf",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<ol><li><p><strong>Log file</strong> (logs all actions and can be used to share with developers for debugging.)<br>Example:<br>QiTissue_2.0.0 Prerelease Version_2019-11-23T03-20-57.log<br></p></li><li><p>The locally <strong>changed biomarkers</strong> (when you make a change in the <a href=\"http://application.qitissue.com/documentation/reference-browsers#Biomarker-Reference\" rel=\"noopener noreferrer nofollow\">biomarker reference window</a>, this is where the changes are stored.)<br>Example:<br>biomarkers.json<br></p></li><li><p><strong>Custom Feature panels</strong> (if you create custom combination of features.)<br>Example:<br>featurePanels.json<br></p></li><li><p><strong>QiProjects</strong> folder (These show the that are listed in the Project Browser window. Not editable, but can be deleted.</p></li></ol>"
        },
        "id": "78e1589f-73dc-4813-b6a3-c4685018a5fe",
        "isHidden": false,
        "type": "list"
    },
    {
        "content": {
            "text": "User Data Directory"
        },
        "id": "f9c6e62c-a7e6-480c-a0b1-e8c283e4cc34",
        "isHidden": false,
        "type": "section-header"
    },
    {
        "content": {
            "text": "<p>How to get there using QiTissue…</p>"
        },
        "id": "e48550bf-3639-42fc-9fde-1307a5d32d93",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><br>Preferences Dialog &gt; General &gt; User Data Directory &gt; push <em>Show In Finder</em> button</p>"
        },
        "id": "105cb191-e5e0-49b5-a8da-bc86febb438f",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><strong><br>On MAC OSX:</strong></p>"
        },
        "id": "d6537671-9431-47df-9bee-a3786b629ccb",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>/Users/xxx/Documents/QiData<br></p>"
        },
        "id": "8371af8f-43f0-456d-9e05-4d1305e9ecdb",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><strong>On Windows:</strong></p>"
        },
        "id": "edcc5aa7-9690-49af-8250-b311d507e769",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>C:\\Users\\xxx\\Documents\\QiData</p>"
        },
        "id": "8897ab7d-7dd7-4ed2-b7e8-48bab4f8b270",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>Contains:</p>"
        },
        "id": "31e40f15-c0f1-4e35-a4be-51d194b90915",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<ol><li><p><strong>Data for each image</strong><br>Example:</p></li></ol>"
        },
        "id": "755c1bf8-f6ef-4d85-8032-444f83338852",
        "isHidden": false,
        "type": "list"
    },
    {
        "content": {
            "location": "kirby",
            "image": [
                "qidata_example.jpg"
            ],
            "src": "",
            "alt": "",
            "caption": "",
            "link": "",
            "ratio": "",
            "crop": "false"
        },
        "id": "a9557795-8752-4250-a0ae-49f6f6298e69",
        "isHidden": false,
        "type": "image"
    },
    {
        "content": {
            "text": "<p>This includes the import and export folders and the computed features and cellmaps</p>"
        },
        "id": "ae388c06-9c4d-45c5-8b70-c649397d2567",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "Image Cache Directory"
        },
        "id": "a4af0d3d-8049-480c-915e-6cb0106abafa",
        "isHidden": false,
        "type": "section-header"
    },
    {
        "content": {
            "text": "<p>How to get there using QiTissue…</p>"
        },
        "id": "c2a88d57-f57a-4d3f-a06d-13cfb7effae8",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><br>Preferences Dialog &gt; Memory Management &gt; Cache &gt; push <em>Show In Finder</em> button</p>"
        },
        "id": "6082298d-4bd7-4943-b88e-91f2e411229c",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "location": "kirby",
            "image": [
                "pref-primary-cache.png"
            ],
            "src": "",
            "alt": "",
            "caption": "",
            "link": "",
            "ratio": "",
            "crop": "false"
        },
        "id": "733c38b6-d2e0-48f7-aebc-844f2f6d478e",
        "isHidden": false,
        "type": "image"
    },
    {
        "content": {
            "text": "<p><strong>On MAC OSX:</strong></p>"
        },
        "id": "eae08ebc-6d21-4a7c-a92a-ff7ec1d1e252",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>/Users/xxx/Library/Caches/Quantitative Imaging/QiTissue</p>"
        },
        "id": "362e3007-124f-4779-84db-0ab5d3392876",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><strong>On Windows:</strong></p>"
        },
        "id": "eb0f44eb-d2c1-49e8-97e8-804aaf00d3b0",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>C:\\Quantitative Imaging\\QiTissue\\Cache</p>"
        },
        "id": "28af2e76-3e40-4fd6-b83b-cb0345e626e3",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p><br>Contains:</p>"
        },
        "id": "3a491567-2875-4395-84f3-acf7021d1311",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<ol><li><p><strong>Cached image data, metadata, and processing pipelines</strong><br>like:<br>6c447782b1d96332a82ac26e69832dd91f54f36f.qiMetadataCache<br>074046eb76a3213da100264a6e73f9b0665f8059.qiPipeline<br>309dc7080312b9b0a44fe5c76978029d92b1c924.324c8ea00a7530792212a87c59523e220ca189cc.qiData</p></li></ol>"
        },
        "id": "02e299c2-2f32-4d53-bb60-2d5291553fa1",
        "isHidden": false,
        "type": "list"
    },
    {
        "content": {
            "text": "Shortcut to access hidden folders"
        },
        "id": "7abca122-fea0-4655-b33b-32333731367f",
        "isHidden": false,
        "type": "section-header"
    },
    {
        "content": {
            "text": "<p><strong>Mac</strong></p>"
        },
        "id": "8c2995f4-d6e8-4b44-a029-8e29ed42f20b",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>Live files are usually stored in three locations: the Application Support, Caches and Preferences folders contained within the user level Library on Mac (Macintosh HD/Users/[your username]/Library):</p>"
        },
        "id": "99cf18b8-73ba-4b1c-a817-acc87c5060c4",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<ol><li><p>Open Finder.</p></li><li><p>Click \"Go\" on the menu bar.</p></li><li><p>Press and hold the “option/alt” key.</p></li><li><p>Click the \"Library\" shortcut which appears.</p></li><li><p>Then navigate to the relevant folder (Application Support, Caches or Preferences)</p></li></ol>"
        },
        "id": "b2ab64ca-100a-4533-aa55-6885abff06a3",
        "isHidden": false,
        "type": "list"
    },
    {
        "content": {
            "text": "<p><strong>Windows</strong></p>"
        },
        "id": "c1f53839-85b2-46a1-a0b7-6c86f8841b9d",
        "isHidden": false,
        "type": "text"
    },
    {
        "content": {
            "text": "<p>Refer to this useful site for help finding hidden folders on Windows:</p>"
        },
        "id": "b42b5632-c380-437c-a0a0-4ef2a42568dd",
        "isHidden": false,
        "type": "text"
    }

results in this error:
image
for which there is no extra info in devtools.
the reason it's probably this plugin is that this works locally, where we have it disabled, and the reason those blocks are at fault is that removing them makes it work fine
apologies for the... vague issue, we're working on figuring it out

Add configuration value for the path to the repository

Currently the plugin assume that the content directory is a separate repository. I don't see a good reason for that, so I would like to use the complete site as a repository.

I would create a pull request that implements a configuration option for the path to the repository, if you would accept it. :)

Allow Prefix (or Suffix) for commit messages

Right now, we're using this plugin to push content changes to the master branches of a site, that also has some CI/CD pipelines defined and attached to that branch. So every commit the plugin makes and pushes triggers a building pipeline what right now is, frankly, really not necessary.

We could stop the pipelines from running by adding a tag link [skip ci] to the commit messages the plugin generates. So at the end of the day, we'd need the option to add some kind of prefix or suffix to the generated commit messages.

Since this is a special request and I don't know if your own usages of the plugin would benefit from this, would you still be open to accepting a PR for this?

Error after installing (Kirby 3) with PHP < 7.3

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

Permission denied with endpoints, but not with manual command push (or pull)

Hi
I believe I must have missed something.
I followed the procedure, but the endpoints, pull and push, give me this error:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

What I don't understand is that when I log in with ssh and the same user, I can push and pull without any problem ...
(Same user = user and group who use apache and have full rights to content files)
Someone would have any idea ?
Thank you very much.

Catch Error when working tree is clean

Been using kirby-git-content successfully on a bunch of sites without problems (thanks a lot for creating this useful plugin! 🙏 )

But on this one I set up git lfs for larger files and I get git error messages like the following when reordering pages in the panel (Other operations seem to be fine). The reordered content is committed and gets pushed, but the error leaves me with an uneasy feeling and is distracting for my panel users (I could of course turn of error display, but then I wouldn't be able to diagnose if real issues should arise).

Screenshot 2021-10-06 at 21 03 35

Kirby config.php extract

'thathoff' => [
    'git-content' => [
      // use the main git repo at the root of the project
      // (instead of the default, a separate git repo for "content")
      'path' => realpath(__DIR__ . '/../../'),
      // silent git errors on production systems
      // so normal users aren’t confused by cryptic messages
      'displayErrors' => true,
      // Push to GitHub after every change. NOTE: makes things a little slower
      // but is easier to maintain for us than a separate cron job
      'push'=> true,
    ],

.gitattributes

content/**/*.png filter=lfs diff=lfs merge=lfs -text
content/**/*.jpg filter=lfs diff=lfs merge=lfs -text
content/**/*.pdf filter=lfs diff=lfs merge=lfs -text
content/**/*.tif filter=lfs diff=lfs merge=lfs -text
content/**/*.tiff filter=lfs diff=lfs merge=lfs -text
content/**/*.jpeg filter=lfs diff=lfs merge=lfs -text
content/**/*.psd filter=lfs diff=lfs merge=lfs -text
content/**/*.mp4 filter=lfs diff=lfs merge=lfs -text
content/**/*.mp3 filter=lfs diff=lfs merge=lfs -text
content/**/*.mov filter=lfs diff=lfs merge=lfs -text
content/**/*.m4a filter=lfs diff=lfs merge=lfs -text
content/**/*.m4p filter=lfs diff=lfs merge=lfs -text
content/**/*.ogg filter=lfs diff=lfs merge=lfs -text

Comments

Hey blankogmbh,
first thanks for this great plugin 👍

I am using this in combination with KirbyComments which creates subpages for each made comment. But of course Panel-Hooks are not triggered when a comment is submitted. Do you have any idea to make this automatically add the comments and push them? (Note: Even if I push manually after a comment is made this doesn't work, because the changes are not added yet)

Thanks!
Dennis

Add authentication to routes

The routes can currently be accessed without any authentication. I think you should make sure that a user is logged in and/or use HTTP basic auth for this.

Windows Support / hangs when committing

I press save in the panel and it greys out, never to return again. When I reload, I can tell it did and is doing something, because the index.lock file is in place and undeletable, and I am given the git error for that situation. Could this be because I'm running this on XAMPP to test it?

Update git dependency

It seems that this project requires the 0.1 version of pascalmh/git.php. Unfortunately this does not exist. For now there is only a v0.1.1-rc.

This happens when I try to install this plugin:

$ composer require blankogmbh/kirby-git-commit-and-push-content
Using version ^1.4 for blankogmbh/kirby-git-commit-and-push-content
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for blankogmbh/kirby-git-commit-and-push-content ^1.4 -> satisfiable by blankogmbh/kirby-git-commit-and-push-content[1.4.0].
    - blankogmbh/kirby-git-commit-and-push-content 1.4.0 requires pascalmh/git.php ^0.1 -> satisfiable by pascalmh/git.php[v0.1.1-rc] but these conflict with your requirements or minimum-stability.


Installation failed, reverting ./composer.json to its original content.

Commits are not pushed to the remote with the default value of `gcapc-branch`

Hello

I noticed that with the default value of gcapc-branch (the empty string), commits are not actually pushed to the remote, since, as it seems, the resulting git call is

git push --tags origin

This does not push the commits on the current branch (using git 2.11.0 here).

Can you confirm this behavior?

While this can be fixed by setting gcapc-branch explicitly, at least the documentation is misleading ("defaults to currently checked out branch").

A fix to consider would be calling

$this->getRepo()->run("push origin $branch");

instead of

$this->getRepo()->push('origin', $branch);

to avoid the --tags option.

What do you think?

Thank you.

Unable to update git: fatal: empty ident name (for <[email protected]>) not allowed

Whenever I try saving content from the panel, i get the following error message:

The form could not be saved
Exception: undefined
Unable to update git: fatal: empty ident name (for <[email protected]>) not allowed

my credentials are definitely set—

% git config --list
> user.name=my name
> [email protected]

I tested multiple times, following the steps in the README.md.
I have an SSH key set and pushing changes from the terminal works just fine.

config.php looks like this:

return [
  'blankogmbh' => [
    'gcapc' => [
      'commit' => true,
      'push' => true,
      'displayErrors' => true,
      'gitBin' => '/usr/bin/git'
    ],
  ],
];

I am using Laravel Valet, PHP 7.4 and MacOS Catalina

Is there anything super obvious I am doing wrong?

git config of php/apache user not set

To make a commit, git needs user.name and user.email. If not set, all commits will silently fail. Setting it as normal user (even as the one apache is running as) does not help. This may be an issue of git.php.

However, setting the respective config entries system wide, solves the problem:

sudo git config --add --system user.name "example"
sudo git config --add --system user.email "[email protected]"

Unfortunately, this overwrites the defaults. Any better solution??

error: unknown option `end-of-options'

I've installed Git Content on a server with git version 2.37.4. At the pull URL (/git-content/pull), I receive the following error, which I've never encountered before:

{"status":"error","message":"error: unknown option `end-of-options'\nusage: git fetch [<options>] [<repository> [<refspec>...]]\n   or: git fetch [<options>] <group>\n   or: git fetch --multiple [<options>] [(<repository> | <group>)...]\n   or: git fetch --all [<options>]\n\n    -v, --verbose         be more verbose\n    -q, --quiet           be more quiet\n    --all                 fetch from all remotes\n    -a, --append          append to .git\/FETCH_HEAD instead of overwriting\n    --upload-pack <path>  path to upload pack on remote end\n    -f, --force           force overwrite of local branch\n    -m, --multiple        fetch from multiple remotes\n    -t, --tags            fetch all tags and associated objects\n    -n                    do not fetch all tags (--no-tags)\n    -p, --prune           prune remote-tracking branches no longer on remote\n    --recurse-submodules[=<on-demand>]\n                          control recursive fetching of submodules\n    --dry-run             dry run\n    -k, --keep            keep downloaded pack\n    -u, --update-head-ok  allow updating of HEAD ref\n    --progress            force progress reporting\n    --depth <depth>       deepen history of shallow clone\n    --unshallow           convert to a complete repository"}

Any suggestions on how to fix?

My config block reads as follows:

'thathoff' => [
    'git-content' => [
      'path' => realpath(__DIR__ . '/../../'),
      'displayErrors' => false,
      'push'=> true,
    ],
  ]

commitMessage option name is wrong

In the readme, it says that the option to set the commit message is called commitMessageTemplate, but it is actually called commitMessage.

See line 27 of KirbyGitHelper.php:

$this->commitMessageTemplate = option('thathoff.git-content.commitMessage', ':action:(:item:): :url:');

Installation

Cannot get it working yet.
My content folder was already a sub repository, so I skipped the step 'Create a new git repository for your content' in the installation instructions. I followed the instructions under 'Download and configure the Plugin'.
When I change content in the panel I just see my changes as unstaged files (not as commits) in my local repository and nothing is pushed to the remote.

Doesnt recognize submodule?

When I try and do a manual push or pull through the panel it says "/home/forge/mysite.com/content" is not a git repository, when in fact it's a submodule in the main repository. Any ideas why it thinks it's not?

Improve error handling

Right now the plugin does "only" trigger an error when there is a problem during the commit process. This errors seem to be ignored by Kirby:

A hook is not expected to return anything. You cannot control the user flow with hooks at this state. They are silently triggered.

I honestly have no idea how to improve this, but for now I always have to create my own debugging function to log it into a separate file.

One way might be to allow a commit to be performed through the cron routes. This would at least trigger the same error as the plugin itself when a hook is called. I'd be ok with not exposing the functionality in the interface, but have it available as a huffed feature.

Any thought?

Thanks! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.