Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40217

Git plugin can't clone when SSH Agent is enabled with different credentials

XMLWordPrintable

      Hi, ...

      How to replicate:
      1. Create freestyle job
      2. Add git scm with SSH url and select ssh key for it
      3. Enable SSH Agent in Build Environment section and select different key for it

      Result:

      Cloning the remote Git repository
      Cloning repository ssh://git@stash:7999/cm/ansible.git
       > git init /opt/jenkins/workspace/ansible/cm-ansible-potiomkin-sync-34 # timeout=10
      Fetching upstream changes from ssh://git@stash:7999/cm/ansible.git
       > git --version # timeout=10
      using GIT_SSH to set credentials jenkins at stash ssh
       > git fetch --tags --progress ssh://git@stash:7999/cm/ansible.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "git fetch --tags --progress ssh://git@stash:7999/cm/ansible.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: Repository not found
      The requested repository does not exist, or you do not have permission to access it.
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      

      Disabling SSH Agent fixes the problem.

      Adding two keys to ssh agent doesn't work as expected for me. It looks like only first ssh key is used/visible.

            Unassigned Unassigned
            emdepl Maciej De
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: