I’m writing a script to automatically push code to a git server.
I’m using php and running the script via the command line.
After asking the user to enter the branch and commit message, the following code runs:
exec(‘git config user.name "’ . $userName . ‘"’);
exec(‘git config user.email "’ . $userEmail . ‘"’);
exec('git checkout -b ’ . $branch);
exec(‘git add --all’);
exec(‘git commit -m "’ . $message . ‘"’);
exec('git push origin ’ . $branch);
When running the last command, the script stops and asks for a user name, then a password.
How can I enter that username and password via the script?
I don’t want to have to type in the user name and password each time.
I’ve been looking on the net for the past 2 days, and I can’t get this right.
Thanks in advance.
Have a lovely day.