Search code examples
gitbitbucketconcourse

Issues cloning a git repo on Bitbucket from Concourse


So, I have a git repo on Bitbucket that I need to monitor as part of a Concourse job. The repo is available, and I have the SSH keys in my ~/.ssh folder, with the right permissions(600). From my machine, I can run the 'git clone [email protected]:/.git' command, and clone the repo successfully. However, when I try to monitor it as a Concourse resource, it fails. What am I doing wrong? Am I missing a configuration option?

The following is my pipeline, and it's rather basic.


resources:
- name: dc
  type: git
  source:
    branch: master
    uri: [email protected]:<company>/<repo>.git


jobs:
- name: Build-docker
  plan:
  - get: dc
    trigger: true
  - task: build-image
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
        repository: ubuntu

     run:
        path: uname
        args: ['r']

What I see on the GUI:

stderr:
Cloning into '/tmp/git-resource-repo-cache'...
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What I see when I run the git-clone locally:

git clone [email protected]:<company>/<repo>.git
Cloning into 'repo'...
Warning: Permanently added the RSA host key for IP address '18.205.93.1' to the list of known hosts.
remote: Counting objects: 50985, done.
remote: Compressing objects: 100% (26500/26500), done.
Receiving objects: 100% (50985/50985), 6.65 MiB | 11.19 MiB/s, done.
remote: Total 50985 (delta 39577), reused 31398 (delta 24283)
Resolving deltas: 100% (39577/39577), done.

Solution

  • Have you fed in your private key using into a secrets.yml file of some kind? and loaded that up when you set your pipeline? e.g.

    resources: - name: dc type: git source: branch: master uri: [email protected]:<company>/<repo>.git private_key: ((private_key))

    Then try

    fly -t "org" set-pipeline -p "pipeline_name" -c "pipeline.yml file name" --load-vars-from "secrets_file.yml"

    This may not work as I'm having a similar issue but you could try that avenue