【问题标题】:git with https did not work in crontab带有 https 的 git 在 crontab 中不起作用
【发布时间】:2017-11-18 23:37:40
【问题描述】:

我想每天早上做'git pull'

所以我写了一个shell脚本run.sh

git --git-dir=/local/git/path/.git pull https://id:pw@bla/bla/bla/bla/bla.git

这个脚本在我运行时运行良好

但是当我使用 crontab 时,这个脚本不起作用并打印错误日志,例如 “致命:无法访问'https://baba@ba/ba.git/':无法解析主机:baba”

不知道是什么原因,

我该如何解决?

【问题讨论】:

  • 您是否使用与 cron 相同的用户运行命令并获得了成功的结果?

标签: git cron


【解决方案1】:

使用sudo su以root用户登录

然后尝试使用sudo crontab -e在 crontab 中添加同一行

再检查一遍,应该是推送的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-19
    • 1970-01-01
    • 2019-10-12
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 2013-11-12
    相关资源
    最近更新 更多