crontab定时运行git命令 更新代码库
Q: http://stackoverflow.com/questions/7994663/git-push-via-cron
I presume it hasn't to do with finding or reading my ~/.ssh/id_rsa, as I can cat the file from cron alright. UID and EUID are set fine in the cron job. - Any ideas?
UPDATE
I got it working when supplying the environment key SSH_AUTH_SOCK to my cron job, but I'm concerned that this is only valid as long as I'm logged in. I'm looking for a solution that works independent of interactive logins.
A:
As explained here,it can be due to the lack of knowledge from the cron session shell of the ssh agent.
If that is the case (ie if you are using private ssh keys with a passphrase), keychain is the usual solution (as mentioned here).
More details in this example: "Passwordless connections via OpenSSH using public key authentication, keychain and AgentForward".
Very brief synopsis
1. Generate private/public key pair (id_dsa and id_dsa.pub).
Save private key in ~/.ssh/id_dsa on trusted hosts you will ssh from.
Append public key to ~/.ssh/authorized_keys on hosts you will ssh to.
Do not use ~/.ssh/authorized_keys2. If you see that file, remove it
and upgrade to a recent version of SSH.
2. Set ForwardAgent yes in ssh_config on all hosts you ssh
from. Set PubkeyAuthentication yes in sshd_config on all
hosts you ssh to. Maybe set StrictModes no in sshd_config.
3. Install keychain then configure by adding the following lines
to your $HOME/.bash_profile:
/usr/local/bin/keychain $HOME/.ssh/id_dsa
source $HOME/.keychain/${HOSTNAME}-sh
4. For crontab scripts that use ssh, add the following line in
order to avoid having to manually enter a passphrase:
source $HOME/.keychain/${HOSTNAME}-sh
5. ssh from host to host without needing to enter passwords. Where
you can ssh, you can also scp, sftp, etc., all securely but without
having to enter your passwords on the various hosts you use.
crontab定时运行git命令 更新代码库的更多相关文章
- 换个视角来看git命令与代码库发生网络交互报错事件
git的一系列命令中像 clone.pull.push等与代码库发生网络交互时,可能报下面的错误信息 fatal: remote error: CAPTCHA required Your Stash ...
- 15分钟学会使用Git和远程代码库
git是个了不起但却复杂的源代码管理系统.它能支持复杂的任务,却因此经常被认为太过复杂而不适用于简单的日常工作.让我们诚实一记吧:Git是复杂的,我们不要装作它不是.但我仍然会试图教会你用(我的)基本 ...
- 使用Git和远程代码库
git是个了不起但却复杂的源代码管理系统.它能支持复杂的任务,却因此经常被认为太过复杂而不适用于简单的日常工作.让我们诚实一记吧:Git是复杂的,我们不要装作它不是.但我仍然会试图教会你用(我的)基本 ...
- 【git】15分钟学会使用Git和远程代码库
Git是个了不起但却复杂的源代码管理系统.它能支持复杂的任务,却因此经常被认为太过复杂而不适用于简单的日常工作.让我们诚实一记吧:Git是复杂的,我们不要装作它不是.但我仍然会试图教会你用(我的)基本 ...
- 15 分钟学会使用 Git 和远程代码库
Git是个了不起但却复杂的源代码管理系统.它能支持复杂的任务,却因此经常被认为太过复杂而不适用于简单的日常工作.让我们诚实一记吧:Git是复杂的,我们不要装作它不是.但我仍然会试图教会你用(我的)基本 ...
- 基于git命令的代码统计方法
基于git命令的代码统计方法 没什么好说的,基于git log命令,使用前提是安装了git ...... .统计所有人代码量 统计所有人代码增删量,拷贝如下命令,直接在git bash等终端,git项 ...
- Linux-Centos 用crontab定时运行python脚本详细步骤
服务器总是要定时运行某个程序,而我在解决这个问题的时候遇到很多困难, 特此记录下来. 1.编辑crontab配置 crontab -e 服务器一般会安装好crontab,若没有安装请按命令安装 yum ...
- crontab 不能执行git命令问题备忘
这问题够隐蔽,折腾了近两个小时. 命令 git checkout tagname 手工执行都正常 但在crontab运行时发现分支一直切不过去. 后来告诉是crontab默认的 path 设置和系统 ...
- 00008 - crontab定时执行任务命令详解
linux 系统则是由 cron (crond) 这个系统服务来控制的.Linux 系统上面原本就有非常多的计划性工作,因此这个系统服务是默认启动的.另 外, 由于使用者自己也可以设置计划任务,所以, ...
随机推荐
- App性能提升方法
总体思路:精简请求数 1.css sprit 图像拼合,将所有可拼接的所有图像拼接为一整张图像,然后再利用css中的position定位来处理,降低图片的请求数 2.懒加载:只渲染客户端用户可见区域[ ...
- 2_1我的第一个应用hello world[wp8特色开发与编程技巧]
2_1hello world -5min 大家好,我是徐文康,在上一个视频当中我们已经讲了,如何根据自己电脑系统去下载相应的SDK. 你可能花了很多时间去安装以及配置好了这个开发环境,如果还没有配置好 ...
- 使用DriverManager获取数据库连接
DriverManager 是驱动的管理类 * 1).可以通过重载的getConnection() 方法获取数据库连接,较为方便 * 2).可以同时管理多个驱动程序,若注册了多个数据库连接,则调用ge ...
- wordpress使用video.js与七牛云存储实现无广告视频分享应用
video.js是一款极受欢迎的基于HTML5的开源WEB视频播放器,其充分利用了HTML5的视频支持特性,可以实现全平台的无视频插件播放功能,对于现在流行的手机.PAD等移动智能终端有极佳的应用体验 ...
- virtualbox安装centos6.5碰到的问题
今天无聊用virtualbox安装centos6.5 , 自己笔记本vm撑不住, 用公司的试试virtualbox先 安装快完成时 没有足够的内存配置kdump”(在英文界面下提示的是“insuffi ...
- document.write() 和 document.writeln() 区别
写javascript页面时,看到这两个函数,第一感觉应该是一个换行,一个不换行, 但是实际使用时是一样的(writeln()函数在浏览器页面会多一个空格而不是换行). 简单搜索查阅了下: 查看源 d ...
- 【Qt】Qt实战一二三【转】
简介 “我们来自Qt分享&&交流,我们来自Qt Quick分享&&交流”,不管你是笑了,还是笑了,反正我们是认真的.我们就是要找寻一种Hold不住的状态,来开始每一天的 ...
- Vue.js 2.0版
Vue.js 2.0版升级,更改了好多方法或指令 new Vue({ el:'#demo', data:{ msg:"vue2.0" } }) v-model lazy numbe ...
- CSS练习
看到一个CSS参考手册:http://css.doyoe.com/ 感谢感谢!
- gdb调试大全
原文:http://blog.csdn.net/dadalan/article/details/3758025