Golang dep private repo

I am trying to setup CircleCi with godep
My project depends on other private repository
I’ve setup project to use my SSH key.

When I am trying to build project it is stuck on go dep (downloading one repo all time).

Do you have some ideas how to solve it?

Readers will need more information and detail to help you. Are you running godep in the CircleCI build container? Can it see the SSH key it needs as if you were performing this action on your local dev machine?

Yes i am running go dep ensure in CircleCi build
.ssh directory is empty (atleast when I was trying to SSH there it was empty)
I was not precise enough - I didnt setup any SSH Permissions keys but I’ve add Checkout keys which is using my user key

version: 2
jobs:
  test:
    docker:
      - image: golang:alpine
    working_directory: /go/src/github.com/XXX/YYY
    environment:
      TERM: dumb
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: |
            apk update && apk add curl git build-base bash
            curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
            dep ensure
      - run:
          name: Static Test
          command: make static-check
      - run:
          environment:
            ENV: TEST
          name: Run tests
          command: make test
workflows:
  version: 2.1
  build-deploy:
    jobs:
      - test

Righto, try an add_ssh_keys step:

https://circleci.com/docs/2.0/configuration-reference/#add_ssh_keys

I got error:
failed to list versions for http://github.com/XXX/myPrivatePackage): fatal: could not read Username for ‘https://github.com’: terminal prompts disabled
I will try to force to use ssh in go dep

I’ve created new ssh key, add to circleCi private, add public in github.
And still it stuck on CircleCI

It seems to be problem with known_hosts
after invoking clone GIT_SSH_COMMAND=“ssh -o StrictHostKeyChecking=no” git clone --depth=1 git@github.com:XXX/YYY.git
before dep ensure it works.
How can I add github to known hosts on circleCi?

Don’t do this - it enables a class of security risks that you should not open yourself up to.

What I do is to use the Build with SSH option in the failed Job UI, get an SSH session, and do the clone manually with interactive prompts. Once this is done, you will have a known_hosts file created.

You can then cat that to the console, and copy+paste it into a local file, which can be committed to a private repo. From there you can copy it in place before doing the checkout.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.