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

Git LFS clone failing when using credentials via GIT_SSH

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-plugin
    • None

      When using git lfs and cloning a repo that uses a set of credentials that are hooked up via the GIT_SSH environment variable the 'pull' fails.

       

      using credential xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      Cloning the remote Git repository
      Cloning repository git@bitbucket.org:someorg/ourrepo.git
       > git init /home/jenkins2/workspace/ourrepo # timeout=10 
      Fetching upstream changes from git@bitbucket.org:someorg/ourrepo.git
       > git --version # timeout=10
      using GIT_SSH to set credentials Our Bitbucket PR Builder
       > git fetch --tags --progress git@bitbucket.org:someorg/ourrepo.git +refs/heads/*:refs/remotes/origin/* # timeout=10 
       > git config remote.origin.url git@bitbucket.org:someorg/ourrepo.git # timeout=10 
       > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 
       > git config remote.origin.url git@bitbucket.org:someorg/ourrepo.git # timeout=10 
      Fetching upstream changes from git@bitbucket.org:someorg/ourrepo.git
      using GIT_SSH to set credentials Our Bitbucket PR Builder
       > git fetch --tags --progress git@bitbucket.org:someorg/ourrepo.git +refs/heads/*:refs/remotes/origin/* # timeout=10 
      Checking out Revision fffffffffff2883fd545b3723b59dccd234c90e5 (refs/remotes/origin/master)
       > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
       > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
       > git config core.sparsecheckout # timeout=10
       > git checkout -f ffffffffffff883fd545b3723b59dccd234c90e5 # timeout=10
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      hudson.plugins.git.GitException: Command "git checkout -f ffffffffff32883fd545b3723b59dccd234c90e5" returned status code 128:
      stdout:
      stderr: Downloading code/someClassification.model (50 KB)
      Error downloading object: code/someClassification.model (951f9b4): Smudge error: Error downloading code/someClassification.model (fffffffffffffffffffffffffffffffffffffffffffffffffffffffff6a35802): batch request: Permission denied (publickey).: exit status 255Errors logged to /home/jenkins2/workspace/ourrepo/.git/lfs/logs/20200207T160753.778675346.log
      Use `git lfs logs last` to view the log.
      error: external filter 'git-lfs filter-process' failed
      fatal: code/someClassification.model: smudge filter lfs failed    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2298)
      

      Jenkins logs the line 'using GIT_SSH' before each of the commands where it expects to be using ssh to download content from the network, the git checkout line isn't one of those.

       

      If I replicate the problem, I can fix it locally by doing the exact same git checkout, but if I have GIT_SSH setup to sort out the credentials it will work.

      The config for this job is in a Jenkinsfile where I've asked it to do an LFS pull too:

       

                      checkout([$class: 'GitSCM',
                              branches: [[name: '*/master']],
                              doGenerateSubmoduleConfigurations: false,
                              extensions: [[$class: 'GitLFSPull']],
                              submoduleCfg: [],
                              userRemoteConfigs: [[credentialsId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
                              url: 'git@bitbucket.org:someorg/ourrepo.git']]])
      
      

      When doing git lfs, and using credentials that are provided using the GIT_SSH env var I would expect it to run the git checkout step with the env var setup so that the checkout works.

       

            Unassigned Unassigned
            cnewell Colin Newell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: