Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git identity not settable on shared hosting #105

Open
easisi opened this issue Feb 14, 2024 · 5 comments
Open

git identity not settable on shared hosting #105

easisi opened this issue Feb 14, 2024 · 5 comments

Comments

@easisi
Copy link

easisi commented Feb 14, 2024

when using the plugin on some shared hosting or other remote servers the git identity isnt set and an error gets thrown.

for example:
Unable to update git: Command 'LC_ALL=C /usr/local/cpanel/3rdparty/bin/git commit '--author=Elias Asisi <****> -m 'update(page): ****'' failed (exit-code 128). Committer identity unknown *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <easisi@server307.web-hosting.com>) not allowed

i already tried modifying the plugin so it includes the -c argument but the error still gets thrown which is also stated here.

is this related to this issue ?
czproject/git-php#85

seems that you have to separately run git config user.name and user.email before every commit.

@thathoff
Copy link
Owner

Hi, thank you for reporting this issue. To clarify, the problem is that you can't set the identity via git config because you don't have shell access to the server, right?

You can try putting the following in a php file to set the config once for the repo. After that it should work. Disclamer: I have not tested this.

system("cd content && /path/to/git config user.email 'you@example.com'");
system("cd content && /path/to/git config user.name 'Your Name'");

Afterwards you can remove this file again.

@easisi
Copy link
Author

easisi commented Feb 15, 2024

i even have shell access and can manually pull the repo without a problem.

i guess when php runs it its a different user. the local config is alright (and even global when i ssh into it). setting the --system git config is impossible as there is no etc directory at the location where it is expected and no permissions to create one.

tried your script at various stages in my code. no change.

i also tried hardcoding the config call in the git-php lib but it still doesnt do the trick..

@thathoff
Copy link
Owner

You can only set the user on a repo basis. So skip the --global option and it'll only be set in the repo and should probably work.

@easisi
Copy link
Author

easisi commented Feb 15, 2024

if i look at the repo config with git config -l everything is there and fine

@easisi
Copy link
Author

easisi commented Feb 15, 2024

looks like a very specific problem to my hosting provider (namecheap). for the moment i have no other ideas and will use my project with the plugin disabled .
i will create a blank project just with the plugin and see if the problem persists when i have time for it. i also contacted the hosting provider about the problem as they would be able to fix this behaviour as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants