{"id":15045318,"url":"https://github.com/jenkinsci/git-parameter-plugin","last_synced_at":"2026-01-16T17:12:00.848Z","repository":{"id":1768922,"uuid":"2686952","full_name":"jenkinsci/git-parameter-plugin","owner":"jenkinsci","description":"Jenkins plugin for chosing Revision / Tag before build","archived":false,"fork":false,"pushed_at":"2026-01-15T15:46:18.000Z","size":1322,"stargazers_count":131,"open_issues_count":43,"forks_count":133,"subscribers_count":107,"default_branch":"master","last_synced_at":"2026-01-15T19:15:57.054Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/git-parameter/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"lukanus/git-parameter","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"community_bridge":"jenkins","custom":["https://www.jenkins.io/donate/#why-donate"]}},"created_at":"2011-11-01T10:58:52.000Z","updated_at":"2026-01-15T15:19:12.000Z","dependencies_parsed_at":"2023-11-21T00:24:42.560Z","dependency_job_id":"d80b5269-b14f-423c-b4c7-cb2a9f89493f","html_url":"https://github.com/jenkinsci/git-parameter-plugin","commit_stats":{"total_commits":328,"total_committers":38,"mean_commits":8.631578947368421,"dds":"0.49085365853658536","last_synced_commit":"17f35528b160b7de483e17ba9c750ab6c1728e8e"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/jenkinsci/git-parameter-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-parameter-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-parameter-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-parameter-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-parameter-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/git-parameter-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgit-parameter-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git"],"created_at":"2024-09-24T20:51:43.626Z","updated_at":"2026-01-16T17:12:00.834Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":["https://funding.communitybridge.org/projects/jenkins","https://www.jenkins.io/donate/#why-donate"],"categories":[],"sub_categories":[],"readme":"# Git Parameter\n\nThis plugin allows you to assign a git branch, tag, pull request, or revision number as a parameter in your builds.\n\nThere is no need to configure anything special in plugin settings.\nThis plugin reads the Git SCM configuration from your projects.\nThis plugin uses the [Git Plugin](https://plugins.jenkins.io/git/) and [Git Client Plugin](https://plugins.jenkins.io/git-client/).\n\n## Basic configuration\n\nThe git parameter plugin supports both [Pipeline projects](#pipeline-script-examples) and [freestyle projects](#freestyle-project-configuration).\n\n## Pipeline script examples\n\nPipeline development is best assisted by the [Pipeline syntax snippet generator](https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator) that is part of the Jenkins Pipeline plugins.\nSnippets for the git parameter plugin can be created with the properties step of the snippet generator or with the parameters section of the declarative directive generator.\n\nThe `gitParameter` Pipeline step has a required argument, `type`, that defines the type of values that will be collected from the remote repository.\nIt must be assigned one of the following values:\n\n* [`PT_BRANCH`](#pt_branch-type) - lists remote branches\n* [`PT_BRANCH_TAG`](#pt_branch_tag-type) - lists remote branches and tags\n* [`PT_TAG`](#pt_tag-type) - lists remote tags\n* [`PT_PULL_REQUEST`](#pt_pull_request-type) - lists remote pull requests\n* [`PT_REVISION`](#pt_revision-type) - lists all revisions in the repository\n\nExamples are provided below for each of those values of `type`.\n\n### `PT_BRANCH` type\n\nThe `PT_BRANCH` type lists the remote branches that match the branch filter regular expression.\n\n* Declarative Pipeline\n```groovy\npipeline {\n  agent any\n  parameters {\n    gitParameter type: 'PT_BRANCH',\n                 name: 'A_BRANCH',\n                 branchFilter: 'origin/(.*)',\n                 defaultValue: 'master',\n                 description: 'Choose a branch to checkout',\n                 selectedValue: 'DEFAULT',\n                 sortMode: 'DESCENDING_SMART'\n  }\n  stages {\n    stage('Example') {\n      steps {\n        git branch: params.A_BRANCH,\n            url: 'https://github.com/jenkinsci/git-plugin.git'\n      }\n    }\n  }\n}\n```\n\n* Scripted Pipeline\n```groovy\nproperties([\n  parameters([\n    gitParameter(type: 'PT_BRANCH',\n                 name: 'A_BRANCH',\n                 branchFilter: 'origin/(.*)',\n                 defaultValue: 'master',\n                 description: 'Choose a branch for checkout',\n                 selectedValue: 'TOP',\n                 sortMode: 'ASCENDING_SMART')\n  ])\n])\nnode {\n  git branch: params.A_BRANCH,\n      url: 'https://github.com/jenkinsci/git-plugin.git'\n}\n```\n\nIf you need to use a different type other than the `PT_BRANCH` parameter type, you **must** use the [`checkout scmGit()` step](https://www.jenkins.io/doc/pipeline/steps/params/scmgit/).\nThe [`git` step](https://www.jenkins.io/doc/pipeline/steps/git/) only supports branches, not tags, pull requests, or other revisions.\n\n###  `PT_BRANCH_TAG` type\n\n```groovy\npipeline {\n  agent any\n  parameters {\n    gitParameter type: 'PT_BRANCH_TAG',\n                 name: 'A_BRANCH_TAG',\n                 defaultValue: 'git-5.6.0',\n                 description: 'Choose a tag or branch to checkout',\n                 selectedValue: 'DEFAULT',\n                 sortMode: 'DESCENDING_SMART'\n  }\n  stages {\n    stage('Example') {\n      steps {\n        checkout scmGit(branches: [[name: params.A_BRANCH_TAG]],\n                        userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])\n      }\n    }\n  }\n}\n```\n### `PT_TAG` type\n\nThe `PT_TAG` type lists the remote tags that match the tag filter wild card.\nNote that the tag filter is a wild card and not a regular expression.\n\n```groovy\npipeline {\n  agent any\n  parameters {\n    gitParameter type: 'PT_TAG',\n                 name: 'A_TAG',\n                 defaultValue: 'git-5.5.2',\n                 description: 'Choose a git-5.x tag to checkout',\n                 selectedValue: 'DEFAULT',\n                 sortMode: 'DESCENDING_SMART',\n                 tagFilter: 'git-5.*' // Only show tags that start with 'git-5.'\n  }\n  stages {\n    stage('Example') {\n      steps {\n        checkout scmGit(branches: [[name: params.A_TAG]],\n                        userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])\n      }\n    }\n  }\n}\n```\n\n### `PT_PULL_REQUEST` type\n\nThe `PT_PULL_REQUEST` type lists pull requests in the remote repository.\n\n```groovy\npipeline {\n  agent any\n  parameters {\n    gitParameter type: 'PT_PULL_REQUEST',\n                 name: 'A_PULL_REQUEST',\n                 defaultValue: '',\n                 description: 'Choose a pull request to checkout',\n                 selectedValue: 'TOP',\n                 sortMode: 'DESCENDING_SMART'\n  }\n  stages {\n    stage('Example') {\n      steps {\n        checkout scmGit(branches: [[name: \"pr/${params.A_PULL_REQUEST}/head\"]],\n                        userRemoteConfigs: [[refspec: '+refs/pull/*:refs/remotes/origin/pr/*',\n                                             url: 'https://github.com/jenkinsci/git-plugin.git']])\n      }\n    }\n  }\n}\n```\n\n### `PT_REVISION` type\n\nThe `PT_REVISION` type lists all the revisions in the repository that are part of the `branch`.\nThe`PT_REVISION` type performs a full clone of the remote repository in order to generate the list of revisions.\n\n```groovy\npipeline {\n  agent any\n  parameters {\n    gitParameter type: 'PT_REVISION',\n                 name: 'REVISION',\n                 branch: 'origin/v3.10.0.x', // Only show commits from v3.10.0.x branch\n                 defaultValue: 'HEAD',\n                 selectedValue: 'TOP',\n                 sortMode: 'DESCENDING_SMART'\n  }\n  stages {\n    stage('Example') {\n      steps {\n        checkout scmGit(branches: [[name: params.REVISION]],\n                        userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])\n      }\n    }\n  }\n}\n```\n\n## Options\n\n### Parameter Type\nName using in Pipeline\n\n```groovy\ntype: 'PT_TAG' or 'PT_BRANCH' or 'PT_BRANCH_TAG' or 'PT_REVISION' or 'PT_PULL_REQUEST'\n```\n\nExplains about `PT_TAG` or `PT_BRANCH` or `PT_BRANCH_TAG`:\n\nPlugin using [git ls-remote](https://git-scm.com/docs/git-ls-remote.html) command to get\nremote tags or branches, this solution was implemented in [JENKINS-40232](https://issues.jenkins.io/browse/JENKINS-40232).\n\nIn code plugin\n[use](https://github.com/jenkinsci/git-client-plugin/blob/9f2a3ec48e699222ce3034dfe14cdb319e563ed5/src/main/java/org/jenkinsci/plugins/gitclient/GitClient.java#L631)ing\ngetRemoteReferences from GitClient, look implementation\nin [CliGitAPIImpl](https://github.com/jenkinsci/git-client-plugin/blob/master/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java).\n\n```java\npackage org.jenkinsci.plugins.gitclient\n//...\n\npublic interface GitClient {\n//...\n    Map\u003cString, ObjectId\u003e getRemoteReferences(String remoteRepoUrl, String pattern, boolean headsOnly, boolean tagsOnly) throws GitException, InterruptedException;\n//...\n}\n```\n\n### Branch\nName using in Pipeline\n\n```groovy\nbranch\n```\n\n### Branch Filter\nName using in Pipeline\n\n```groovy\nbranchFilter\n```\n\n### Tag Filter\nName using in Pipeline\n\n```groovy\ntagFilter\n```\n\n### Sort Mode\nName using in Pipeline\n\n```groovy\nsortMode: 'NONE' or 'ASCENDING_SMART' or 'DESCENDING_SMART' or 'ASCENDING' or 'DESCENDING'\n```\n\nYou can select the following sorting options for\ntags/revision/branches/branches\\_or\\_tags/pull requests\n\n-   none\n-   descending\n-   ascending\n-   ascending smart\n-   descending smart\n\nFor the smart variants the compare treats a sequence of digits as a\nsingle character. Contributed by Graeme Hill.\n\n### Default Value\nName using in Pipeline\n\n```groovy\ndefaultValue\n```\n\nSet a default value because this value is used in the initial build (in Pipeline).\nDefault value is also returned when an error occurs retrieving data.\n\n![default value](docs/images/image2019-2-16_22-46-54.png)\n\n### Selected Value\nName using in Pipeline\n\n```groovy\nselectedValue: `NONE` or `TOP` or `DEFAULT`\n```\n\n### Use repository\nName using in Pipeline\n\n```groovy\nuseRepository\n```\n\n**Remember!**\nYou don't set a git repository in the plugin.\nThe plugin uses the git repositories defined in the SCM section of the project.\n\nIf multiple repositories are defined, this option specifies which the repository is used to retrieve the parameter values.\n*If the `useRepository` option is not defined, the first defined repository is used.*\nThis option is a regular expression, which is compared to the 'Repository URL'.\n\nYou can use multiple SCM repositories in a Pipeline.\n\nConsider an example based on two repositories:\n\n-   \u003chttps://github.com/klimas7/exampleA.git\u003e\n-   \u003chttps://github.com/klimas7/exampleB.git\u003e\n\n**Pipeline: Complex example**\n\n```groovy\npipeline {\n    agent any\n    parameters {\n        gitParameter branchFilter: 'origin.*/(.*)', defaultValue: 'master', name: 'BRANCH_A', type: 'PT_BRANCH', useRepository: '.*exampleA.git'\n        gitParameter branchFilter: 'origin.*/(.*)', defaultValue: 'master', name: 'BRANCH_B', type: 'PT_BRANCH', useRepository: '.*exampleB.git'\n\n    }\n    stages {\n        stage('Example') {\n            steps {\n                git branch: params.BRANCH_A, url: 'https://github.com/klimas7/exampleA.git'\n                git branch: params.BRANCH_B, url: 'https://github.com/klimas7/exampleB.git'\n            }\n        }\n    }\n}\n```\n\nAfter initial run you get\n\n!['build with parameters' section](docs/images/image2018-9-21_22-47-52.png)\n\nExample when 'Use repository' is not set:\n\n**Pipeline: Use repository is not set**\n\n```groovy\npipeline {\n    agent any\n    parameters {\n        gitParameter branchFilter: 'origin.*/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'\n    }\n    stages {\n        stage('Example') {\n            steps {\n                git url: 'https://github.com/klimas7/exampleA.git'\n                dir('dir-for-exampleB') {\n                    git url: 'https://github.com/klimas7/exampleB.git'\n                }\n            }\n        }\n    }\n}\n```\n\nAfter initial run you get\n\n!['build with parameters' section](docs/images/image2018-9-21_23-3-22.png)\n\n### Quick Filter\n\n```groovy\nquickFilterEnabled\n```\n\n### List Size\n\n```groovy\nlistSize\n```\n\n## Freestyle project configuration\n\n![project configuration image](docs/images/freestyle-parameters.png)\n\n![project configuration SCM image](docs/images/freestyle-parameters-scm.png)\n\n### Build with Parameters form\n\n![Build with Parameters image](docs/images/freestyle-build.png)\n\n## Global configuration\n\n![show 'need to clone' information](docs/images/image2019-2-16_22-26-39.png)\n\n![parameter values](docs/images/image2019-2-17_13-5-14.png)\n\n## Error handling\n\nIf an error occurred while retrieving data, the default value is returned.\nAdditional information is provided below, along with the cause of the error.\n\nExamples:\n1. This error occur when the repository is not configured or 'Use repository' option not match with any repository.\n   ![error handling 1](docs/images/image2019-2-17_17-2-14.png)\n2. This error occur when the repository is not exists or URL is wrong.\n   ![error handling 2](docs/images/image2019-2-17_12-49-47.png)\n3. This error occur when there are no ssh command on Jenkins master.\n   ![error handling 3](docs/images/image2019-2-17_17-4-32.png)\n\n## Changelog\n\nFor recent versions, see [GitHub Releases](https://github.com/jenkinsci/git-parameter-plugin/releases)\n\nFor versions 0.9.11 and older, see the [legacy CHANGELOG](https://github.com/jenkinsci/git-parameter-plugin/blob/git-parameter-0.9.19/CHANGELOG.md)\n\n## Properties\n\nAs part of [SECURITY-3419](https://www.jenkins.io/security/advisory/2025-07-09/#SECURITY-3419), the git parameter plugin now validates the value of the parameter before starting the job.\nIf a bug in the plugin prevents you from using that safer setting, the validation can be disabled by setting the system property\n\n```\n-Dnet.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition.allowAnyParameterValue=true\n```\n\nThat setting can be modified as a [system property](https://www.jenkins.io/doc/book/installing/initial-settings/#jenkins-properties) from the command line that starts Jenkins.\n\nThe validation can also be disabled from the [Groovy script console](https://www.jenkins.io/doc/book/managing/script-console/) with the script:\n\n```\nimport net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition;\n\nGitParameterDefinition.allowAnyParameterValue=true;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgit-parameter-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fgit-parameter-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgit-parameter-plugin/lists"}