git-plugin icon indicating copy to clipboard operation
git-plugin copied to clipboard

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

Open jenkins-infra-bot opened this issue 3 years ago • 5 comments

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.

 


Originally reported by rayanmoarkech, imported from: "git lfs install" fails on Windows agents with git plugin v4.12.1
  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02
Raw content of original issue

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.

 

environment
Jenkins: v2.361.1<br/>
Git Plugin: v4.12.1
1 attachment

jenkins-infra-bot avatar Oct 02 '22 01:10 jenkins-infra-bot

markewaite:
  • Original comment link
  • Raw content of original comment:

    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.

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.

jenkins-infra-bot avatar Oct 02 '22 03:10 jenkins-infra-bot

rayanmoarkech:
  • Original comment link
  • Raw content of original comment:

    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.

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.

jenkins-infra-bot avatar Oct 03 '22 16:10 jenkins-infra-bot

rayanmoarkech:
  • Original comment link
  • Raw content of original comment:

    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.

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.

jenkins-infra-bot avatar Oct 04 '22 14:10 jenkins-infra-bot

markewaite:
  • Original comment link
  • Raw content of original 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.

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.

jenkins-infra-bot avatar Oct 04 '22 15:10 jenkins-infra-bot

rayanmoarkech:
  • Original comment link
  • Raw content of original 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.

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.

jenkins-infra-bot avatar Oct 04 '22 15:10 jenkins-infra-bot