Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

Your Answer


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.