Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a private repository in CircleCI?

I am a tester of plugins of Redmine. I want to test all plugins.

In order to do so,I set .circleci/config.yml under one plugin's repository (managed by Github) and tried to test. But I got following mistake message.

    #!/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

I want to find out the way of getting the clones of private repositories which are different from the repository I am using now.

The following is my .circleci/config.yml now.

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
like image 763
hane Avatar asked Feb 05 '23 01:02

hane


1 Answers

You'd need to add a private SSH key to CircleCI that has access to the GitHub repository that you are trying to clone. This would be done via the CircleCI webapp in the project's settings page. More information here: https://circleci.com/docs/2.0/gh-bb-integration/#enable-your-project-to-check-out-additional-private-repositories

like image 179
FelicianoTech Avatar answered Feb 07 '23 08:02

FelicianoTech