Comments (9)
Great !
That's work !
Maybe this very useful information need to be in the readme ?
Anyway, Thank you so much Markus. :)
I close this issue.
from kirby-git-content.
Most of the time this happens due to php using the wrong ssh key or using the wrong username because the shell environment of php is different to the one you use via ssh.
So I think you have two options:
- Try to emulate the webserver env as closely as possible and debug from this point (eg. setting env vars etc)
- Since you have shell access on your server you can also create a cron running the push command via shell and not via the plugin’s webhooks (cd /path/to/website && git push).
Best,
Markus
from kirby-git-content.
Thanks for the amazingly quick response.
I am just doing my tests on a local docker environment, and I also initially thought that php was not using the same user as the one I was pushing or pulling in ssh with.
I corrected. The problem remains ...
And unfortunately, I wouldn't be able to do real cron jobs on the production server, only run webhooks.
from kirby-git-content.
The users and groups in my docker environment were messy.
I reccomanced everything on a "new" server, a replica of the production one.
I still have the same error.
How do I get php to use a user who has rights to ssh keys?
from kirby-git-content.
You can run docker run -ti php:fpm-alpine sh
or (you need to replace php:fpm-alpine with the image you’re using). Then you can check the home dir of all users by running cat /etc/passwd
. There you need to find the user the image is starting the php process (in case of the official PHP image it’s www-data
).
When running the image you need to put a folder called .ssh
in the homedir containing the private key which has access to the git repo.
You can test this by starting the image with docker run -ti -u www-data php:fpm-alpine
and try to fetch/push afterwards.
Hope that helps! :)
from kirby-git-content.
Hi Markus
Thanks a lot for your time.
On my Docker image, I connected via
sudo docker exec -it -u ben:www-data docker_web_1 bash
In order to force the ben user and the www-data group, which are the ones with which I had configured php-apache in my docker file.
I was in doubt that my user / group ssh was the same as the one used by php.
I put everything back on a new config, online, and on which I am sure that the users and groups are the same.
It continues to produce this error ...
I have a question, maybe stupid. Could the know_hosts file be the cause?
I think about this because it makes sense to me that when kirby uses his own end-points, he is recognized.
But if, as I've been trying to do for a few hours, I hit them from a simple remote http request, how can I be recognized as a know host?
Another lead. Does the git config (config.name and config.email) have to reflect that of the repo?
I keep digging ...
from kirby-git-content.
Without knowing your exact setup it’s hard to give you any new hints, I’m sorry… :)
But at least I can let you know that we use this plugin with Docker in various setups and it’s working very well. So I think it’s “just” a matter of finding the right place to put the right ssh-key.
from kirby-git-content.
Hi Markus,
Thanks again for your time.
Yes, I know that without having my configuration, it's not easy to help me more than you have already done.
I tried to re-start everything on two completely different servers, my local docker and a remote cloud. It does not work.
I tried to change the users, groups, permissions. It does not work.
I 'm dropping these "conventional" attempts and return to pragmatism .
Related to kbjr/Git.php#14, I tested modifying the push() method. And it works.
For the moment, I have simply hardcoded
$ this->getRepo()->push('https://USERNAME:[email protected]/USERNAME/REPO.git', $branch);
Instead of
$this->getRepo()->push('origin', $branch);
Obviously, this implies abandoning SSH authentication in favor of HTTPS.
Certainly much less secure but it works.
For my project, this level of security is sufficient, I think I will fork your repo to allow the user and the password to be injected from Kirby's options. Then I will change the arguments passed in the push and pull methods conditionally.
I'm not a fan of storing the password in the config file.
Maybe grabbing an environment variable would be a more secure way.
from kirby-git-content.
You can also change the origin using this full url. git remote set-url origin https://USERNAME:[email protected]/USERNAME/REPO.git
that might work too without the need to modify the plugin code.
from kirby-git-content.
Related Issues (20)
- Use of functions deprecated in Kirby v4 HOT 4
- Custom Path and some other options not settable HOT 2
- Call to a member function format() on bool HOT 1
- git identity not settable on shared hosting HOT 5
- Add buttons to revert/drop commits HOT 1
- SSH key issues with dokku HOT 3
- Is it normal to end up with all sorts of uncommitted `.lock` file deletes? HOT 3
- Add info about .lock files into README
- plugin possibly causes internal server errors with certain characters HOT 5
- switch to original git PHP lib (kbjr/Git) HOT 2
- Catch Error when working tree is clean HOT 1
- Add a panel button to push to remote HOT 3
- Array to string conversion error with Kirby 3.6 and PHP 8.0 HOT 8
- Return status for KirbyGitHelper::push() and ::pull() HOT 1
- Working fine locally but not committing when on public server HOT 5
- Only add files of changed page
- Working locally but not on server HOT 4
- Problems with Kirby 3.8.0-rc1 when installing without composer HOT 23
- error: unknown option `end-of-options' HOT 9
- 'KirbyGitHelper::$git is deprecated' error on saving HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby-git-content.