gpt4 book ai didi

git - BitBucket 使用 Cron Job 自动 pull

转载 作者:行者123 更新时间:2023-12-04 19:13:57 26 4
gpt4 key购买 nike

我试图创建 CronJob 到 git pull每分钟都让我的 QA 环境保持最新状态。

git pull 需要由系统用户完成。在 .git 存储库中,我确实使用用户名和密码配置了远程源。

https://{username}:{password}@bitbucket.org/{projectname}/project.git

在 Cornjob 中,我确实编写了以下代码以每分钟运行一次。
*/1 * * * * su -s /bin/sh nobody -c 'cd /var/www/project && /usr/bin/git pull -q  origin branchname'

执行后,显示以下错误。
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed

有人可以帮帮我吗?

最佳答案

用户 nobody无权访问 /var/www/project .在拥有的用户下运行命令。或给用户nobody必要的权利。

或者更好的是,在 bitbucket 上配置一个网络钩子(Hook),它会通知您更改;这样你根本不需要轮询 bitbucket。

关于git - BitBucket 使用 Cron Job 自动 pull ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45588233/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com