为什么通过crontab运行某些git命令会失败?

时间:2018-12-23 22:28:37

标签: git cron

我正在尝试创建一个cron作业(macOS),该作业会定期访问我拥有的远程git存储库。但是,使用crontab运行命令时,访问git凭据时遇到了麻烦。

当我通过crontab运行等效于git config --global -l时,我可以访问我的git配置:

user.name=myUsername
user.email=myEmail@gmail.com
filter.lfs.clean=git-lfs clean %f
filter.lfs.smudge=git-lfs smudge %f
filter.lfs.required=true
credential.helper=osxkeychain`

但是,当我尝试通过crontab从遥控器中拉出时,会引发以下错误:

git: 'credential-osxkeychain' is not a git command. See 'git --help'.
fatal: could not read Username for 'https://github.com': Device not configured

另外,当我通过crontab运行/usr/bin/security find-internet-password -gs github.com时,出现错误消息:

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.

即使这在外壳程序中也有效。

对于为什么我能够从我的git配置中读取但git无法从钥匙串中读取,我感到困惑。有没有办法手动将钥匙串参数传递给git?我必须为我的钥匙串设置特定权限吗?

我知道类似的帖子,但不认为他们回答了这些问题。

0 个答案:

没有答案