I need to use git commands in a php project.
Example :
exec('git clone <repo>');
The problem is that the command (used via an exec()) asks for my username and password. Which I don't have to enter when I run the command in a shell since I am using an ssh key.
I guess the problem appear because www-data does not know or does not have access to my ssh key?
Do you know any solution for that problem?
Thanks!
/var/www/.ssh/id_rsa(or whatever that user's home dir is configured as) so www-data's default identity is 'you' - kinda depends why you want to do this e.g. is this a public service? a hobby project? Some internal tool? Please add a little more context about why you need to do this. I sure hope you aren't piping invalidated user input into these exec calls :).