【问题标题】:Jenkins credentials for cloning a github repository via ssh when deploying部署时通过 ssh 克隆 github 存储库的 Jenkins 凭据
【发布时间】:2016-12-09 07:29:50
【问题描述】:

我在让 jenkins 进行作曲家更新时遇到了一些问题,因为作曲家依赖项之一是托管在 Github 上的私有 git 存储库

我也无法让 composer update 命令在命令行中工作:

$ cd /var/lib/jenkins/jobs/JOB/workspace
$ ls -la auth.json
-rw-rw-r-- 1 jenkins jenkins 99 Aug  3 15:49 auth.json
$ cat auth.json
{
    "github-oauth" : {
        "github.com" : "<notAvailableOnSO>"
    }
}
$ composer update -n

错误:

Failed to clone the git@github.com:<Org>/<Project>.git repository, try running in interactive mode so that you can enter your GitHub credentials

[RuntimeException]
Failed to execute git clone --mirror 'https://***:***@github.com/<Org>/<Project>.git' '/var/lib/jenkins/.composer/cache/vcs/git-github.com-<Org>-<Project>.git/'
Cloning into bare repository '/var/lib/jenkins/.composer/cache/vcs/git-github.com-<Org>-<Project>.git'...
remote: Repository not found.
fatal: repository 'https://***:***@github.com/<Org>/<Project>.git/' not found

我正在尝试更新的项目的 composer.json 中有这个存储库设置:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/<Org>/<Project>.git"
    }
]

即使没有 -n(交互模式),我也可以输入 github oauth 令牌并让 composer 报告令牌已保存,但仍然出现错误。

我是否将 auth.json 放在了错误的位置,还是应该以不同的方式进行授权?

(为了部署工作,显然不可能在github上发布专有源代码)

【问题讨论】:

  • 使用命令 $ ssh -T git@github.com 测试 ssh 设置返回 Hi tasklift-jenkins!您已成功通过身份验证,但 GitHub 不提供 shell 访问权限。

标签: github jenkins oauth composer-php


【解决方案1】:

我让“composer update”命令工作(命令行和通过 jenkins)。

在实际阅读错误消息并了解存储库对用户不可用后,登录到 github,我通过确保 github 用户实际上被允许对存储库进行读取访问来解决我的问题。

:)

【讨论】:

    猜你喜欢
    • 2011-05-24
    • 2019-10-03
    • 1970-01-01
    • 2012-04-04
    • 2020-09-21
    • 2020-08-27
    • 1970-01-01
    • 2021-12-31
    • 2016-05-07
    相关资源
    最近更新 更多