如何在CircleCI中使用私有存储库?

时间:2018-02-07 03:31:29

标签: github ssh circleci

我是Redmine插件的测试人员。我想测试所有插件。

为了做到这一点,我将 .circleci / config.yml 设置在一个插件的存储库(由Github管理)下并尝试进行测试。但我得到了以下错误信息。

    #!/bin/bash -eo pipefail
    git clone https://github.com/xxxxxx/lad.git
    Cloning into 'lad'...
    ERROR: Repository not found.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.
    Exited with code 128

我想找出获取私有存储库克隆的方法,这些存储库与我现在使用的存储库不同。

以下是我的 .circleci / config.yml

version: 2

jobs:
  build:
    docker:
      - image: ruby:2.3.0
        environment:
      - LANG: C.UTF-8
    environment:
      BUNDLE_GEMFILE: /root/project/.circleci/Gemfile
    steps:
      - checkout
      - run: git clone --depth=1 --branch=${REDMINE_VERSION:-3.4-stable} https://github.com/redmine/redmine.git
      # this is private repository ↓
      - run: git clone https://github.com/xxxxxx/lad.git
      - run:
          name: Check status
          command: |
            pwd
            ls -al

1 个答案:

答案 0 :(得分:8)

您需要向CircleCI添加一个私有SSH密钥,该密钥可以访问您尝试克隆的Github存储库。这可以通过项目设置页面中的CircleCI webapp完成。更多信息请访问:https://circleci.com/docs/2.0/gh-bb-integration/#enable-your-project-to-check-out-additional-private-repositories