Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using crontab for synchronizing git repositories. I was able to do operations like git add and commit, but can't perform git push to origin, since every git push asks for a password.

How can I connect to the server using git push using cron?

share|improve this question
add comment

2 Answers

You can use git over different transport methods.

It is common to access a remote git repository over a ssh connection.

And with ssh you can configure public-key-authentication, which is password-less (when your private-key has no password set).

It is recommended to generate new ssh-key-pairs for different remote destinations - and depending on if you need password-less access or not you can decide whether to protect the private-key with a password or not (the password would only be used to locally decrypt the private-key during authentication).

See for example the ssh-notes of the github team.

share|improve this answer
    
thankyou.... let me try out it... –  rani Apr 8 '12 at 10:24
add comment

Followup to maxschlepzig

Better way may be push not from cron, but in post-commit hook (less useless operations, you can enter password on request)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.