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

"git lfs install" fails on Windows agents with git plugin v4.12.1

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins: v2.361.1
      Git Plugin: v4.12.1

      The v4.12.1 git plugin breaks when doing "git lfs install" during a Jenkins job. The attached image shows the error. It also breaks the command on the machine in the repo directory. It works when I delete the repo folder on the machine and rerun the job, but when I re-run it again it will always break.

      Error has a weird path "\NUL:\pre-push" and saying that the path is incorrect. Not sure why it cannot go to .git\pre-push.

      The issue was never there. I can confirm that having the git plugin on v4.11.5 works really fine.

       

          [JENKINS-69760] "git lfs install" fails on Windows agents with git plugin v4.12.1

          Mark Waite added a comment - - edited

          You might try allowing hooks on the agent as described in the "Security Configuration" section of the git plugin documentation. You may also consider moving the git lfs install call to be performed once per agent rather than once per job. Large file storage only needs to be initialized once per account.

          I've confirmed in my installation that if git hooks are enabled on the Windows agent, then you can call git lfs install without issue. It appears that git lfs install on Windows does not like the way that we prevent the execution of checkout hooks on the agent.

          If you must perform the git lfs install in a Freestyle job, another option is to install the pre-scm step plugin and add a pre-scm step that performs the bat command git lfs install before the SCM checkout happens.

          A Pipeline option is to perform the git lfs install before the checkout scm. If you're using declarative Pipeline, then you'll need to add the skipDefaultCheckout option, otherwise there will already be a default checkout before the git lfs install is run.

          Mark Waite added a comment - - edited You might try allowing hooks on the agent as described in the "Security Configuration" section of the git plugin documentation. You may also consider moving the git lfs install call to be performed once per agent rather than once per job. Large file storage only needs to be initialized once per account. I've confirmed in my installation that if git hooks are enabled on the Windows agent, then you can call git lfs install without issue. It appears that git lfs install on Windows does not like the way that we prevent the execution of checkout hooks on the agent. If you must perform the git lfs install in a Freestyle job, another option is to install the pre-scm step plugin and add a pre-scm step that performs the bat command git lfs install before the SCM checkout happens. A Pipeline option is to perform the git lfs install before the checkout scm . If you're using declarative Pipeline, then you'll need to add the skipDefaultCheckout option, otherwise there will already be a default checkout before the git lfs install is run.

          Rayan Moarkech added a comment - - edited

          markewaite Ah nice. Thank you! This security option seems to be a new feature. Enabling it fixed my issue. I will try the other steps you told me.

          Rayan Moarkech added a comment - - edited markewaite Ah nice. Thank you! This security option seems to be a new feature. Enabling it fixed my issue. I will try the other steps you told me.

          Rayan Moarkech added a comment - - edited

          The comment of Mark Waite fixed the issue:

          You might try allowing hooks on the agent as described in the "Security Configuration" section of the git plugin documentation. You may also consider moving the git lfs install call to be performed once per agent rather than once per job. Large file storage only needs to be initialized once per account.

          I've confirmed in my installation that if git hooks are enabled on the Windows agent, then you can call git lfs install without issue. It appears that git lfs install on Windows does not like the way that we prevent the execution of checkout hooks on the agent.

          If you must perform the git lfs install in a Freestyle job, another option is to install the pre-scm step plugin and add a pre-scm step that performs the bat command git lfs install before the SCM checkout happens.

          A Pipeline option is to perform the git lfs install before the checkout scm. If you're using declarative Pipeline, then you'll need to add the skipDefaultCheckout option, otherwise there will already be a default checkout before the git lfs install is run.

          Rayan Moarkech added a comment - - edited The comment of Mark Waite fixed the issue: You might try allowing hooks on the agent as described in the  "Security Configuration" section  of the git plugin documentation. You may also consider moving the  git lfs install  call to be performed once per agent rather than once per job. Large file storage only needs to be initialized once per account. I've confirmed in my installation that if git hooks are enabled on the Windows agent, then you can call  git lfs install  without issue. It appears that  git lfs install  on Windows does not like the way that we prevent the execution of checkout hooks on the agent. If you must perform the  git lfs install  in a Freestyle job, another option is to install the pre-scm step plugin and add a pre-scm step that performs the  bat  command  git lfs install  before the SCM checkout happens. A Pipeline option is to perform the  git lfs install  before the  checkout scm . If you're using declarative Pipeline, then you'll need to add the  skipDefaultCheckout  option, otherwise there will already be a default checkout before the  git lfs install  is run.

          Mark Waite added a comment -

          Thanks rayanmoarkech .  I've listed the issue as still open because I would prefer that we find a way to allow jobs to call git lfs install on Windows without needing to allow hooks on agents.  I don't know that we'll be able to solve the issue short term, but wanted it noted that it is a known issue with several alternatives to workaround the problem.

          Mark Waite added a comment - Thanks rayanmoarkech .  I've listed the issue as still open because I would prefer that we find a way to allow jobs to call git lfs install on Windows without needing to allow hooks on agents.  I don't know that we'll be able to solve the issue short term, but wanted it noted that it is a known issue with several alternatives to workaround the problem.

          Sounds good markewaite . Thank you! Just note that the issue is also on MacOS too. With the launch method: `Launch agent by connecting it to the controller` for the slave.

          Rayan Moarkech added a comment - Sounds good markewaite . Thank you! Just note that the issue is also on MacOS too. With the launch method: ` Launch agent by connecting it to the controller`  for the slave.

            Unassigned Unassigned
            rayanmoarkech Rayan Moarkech
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: