# Checkout jenkins pipeline code from git tag

**URL:** <https://community.jenkins.io/t/checkout-jenkins-pipeline-code-from-git-tag/14307>\
**Category:** Using Jenkins\
**Created:** [April 17, 2024, 10:10am UTC](https://community.jenkins.io/t/checkout-jenkins-pipeline-code-from-git-tag/14307 "2024-04-17T10:10:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamaszsellerp92](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/tamaszsellerp92/32/5706_2.png) [@tamaszsellerp92](https://community.jenkins.io/u/tamaszsellerp92)\
**Post date:** [April 17, 2024, 10:10am UTC](https://community.jenkins.io/t/checkout-jenkins-pipeline-code-from-git-tag/14307/1 "2024-04-17T10:10:12Z")

</div>

My jenkinsfiles for the pipelines are stored next to the code in the main repository. I would like to deploy to commit tags, but jenkins fails to checkout the repo to read the pipeline code during the “Declarative checkhout” initial step.

I use a parameter named Branch in the pipeline to specify which branch/tag I need.  
I use ${Branch} in the pipeline configuration, it handles branches correctly, but not tags.

I receive this:  
hudson.plugins.git.GitException: Command “git fetch --tags --force --progress --prune – origin +refs/heads/3.12.0-hotfix1:refs/remotes/origin/3.12.0-hotfix1” returned status code 128:  
stdout:  
stderr: fatal: couldn’t find remote ref refs/heads/3.12.0-hotfix1  
fatal: the remote end hung up unexpectedly

git show-ref --tags returns the tags correctly  
ad556d37f45351f424d7cb065fc1a94282a40390 refs/tags/3.12.0-hotfix1

any clue? thanks!

---

<div class="post-metadata">

**Author:** ![tamaszsellerp92](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/tamaszsellerp92/32/5706_2.png) [@tamaszsellerp92](https://community.jenkins.io/u/tamaszsellerp92)\
**Post date:** [April 17, 2024, 11:06am UTC](https://community.jenkins.io/t/checkout-jenkins-pipeline-code-from-git-tag/14307/2 "2024-04-17T11:06:19Z")

</div>

answering my own question: disabling lightweight checkout solves the issue.  
from the Help bubble:  
" Also build parameters will not be substituted into SCM configuration in this mode. "
