I need to have a crontab entry that pushes changes to a remote git repo.
The remote is currently specified as:
origin https://username@server/git/repo.git (push)
My crontab entry would then do: git push
How can I disable the need for asking for a password?
You need to create a .netrc file in your home directory. Nobody without root access can read from your home directory. Search for .netrc file, because .netrc configuration changes according to your host server.
But generally it goes like this:
machine your.host.server.com
login yourUserName
password yourPassWord
As Charlie said, you just need to:
ssh-keygen -t rsa -b 4096 -C "$(whoami)@$(hostname)-$(date -I)"
) You should be set if you just want to not be prompted a password. If you want to still use HTTPS, I am not sure how to.
Just make sure that you use the correct notation for the push and pull (it is different when you use HTTPS or SSH, notably you access the URL with git@bitbucket.org:<username>/<reponame>.git
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.