1

Any idea how to send the password after the push command?

exec("git add *");
exec("git commit -m 'first commit'");
exec("git push origin master")

Badly needed your advice on how to do this one.
Any suggestions would highly appreciated.

Thanks

tanix
  • 71
  • 1
  • 9
  • There are a few ideas: http://stackoverflow.com/questions/5343068/is-there-a-way-to-skip-password-typing-when-using-https-github – Lajos Veres Jan 22 '14 at 08:22
  • @LajosVeres Where in your link example of *pushing in git using exec* with **php**? – Victor Bocharsky Jan 22 '14 at 08:39
  • @ÁlvaroG.Vicario And it will be straight work? Do you tested it? – Victor Bocharsky Jan 22 '14 at 08:46
  • @Victor: the related links could help to send the credentials to git. Otherwise you are right, this is not an exact answer, only a comment. – Lajos Veres Jan 22 '14 at 09:07
  • What kind of password is needed exactly? SSH credentials? – deceze Jan 22 '14 at 09:16
  • @LajosVeres I don't tested your example yet, but I very interested if it work. I think maybe you tested :) – Victor Bocharsky Jan 22 '14 at 09:18
  • 1
    If you are can use ssh instead of https to connect to your git repo, I'd use (non-interactive) public key authentication. There is also the 'expect' unix programm to handle interactive prompts... – Paul Voss Jan 22 '14 at 09:18
  • 1
    For ssh, I would also suggest public key auth. – Lajos Veres Jan 22 '14 at 09:31
  • In this case you could generate a keypair (see 'ssh-keygen' manual) and put your public (!) key in the remote host's ~/.ssh/authorized_keys file. It's required that the remote ssh server accepts public key authentication (most do). Details are described here: http://stackoverflow.com/questions/7260/how-do-i-setup-public-key-authentication – Paul Voss Jan 22 '14 at 09:34
  • I user this to generate the key `ssh-keygen -t dsa` . It gives me this one
    `open /root/.ssh/id_dsa failed: Read-only file system.
    Saving the key failed: /root/.ssh/id_dsa.`
    – tanix Jan 22 '14 at 09:35
  • Well this seems to be a misconfiguration of the operating system and probably should be discussed elsewhere (you should NOT be user "root" and your home directory located at something like /home/username). :/ – Paul Voss Jan 22 '14 at 13:52

0 Answers0