Resolver Type
This resolver responds to typegit.
Parameters
URL of the repo to fetch and clone anonymously. Either
url, or repo (with org) must be specified, but not both.Example: https://github.com/tektoncd/catalog.gitThe repository to find the resource in. Either
url, or repo (with org) must be specified, but not both.Example: pipeline, test-infraThe organization to find the repository in. Default can be set in configuration.Example:
tektoncd, kubernetesGit revision to checkout. This can be commit SHA (SHA-1 or SHA-256), branch, or tag.Example:
aeb957601cf41c012be462827053a21a420befca, main, v0.38.2Where to find the file in the repo.Example:
task/golang-build/0.3/golang-build.yamlOptional secret name to fetch the API token from. Defaults to configuration from global configmap.Example:
secret-nameOptional key in the token secret to fetch the token from.
Optional secret name for git clone authentication. When empty, uses anonymous cloning.Example:
secret-gitauth-tokenOptional key in the gitToken secret to fetch the token from.
Optional server URL for API operations.Example:
https://github.mycompany.comOptional SCM type for API operations.Options:
github, gitlab, gitea, bitbucketcloud, bitbucketserverControls caching behavior for the resolved resource.Options:
always, never, autoRequirements
- A cluster running Tekton Pipeline v0.41.0 or later
- Built-in remote resolvers installed
- The
enable-git-resolverfeature flag set totruein theresolvers-feature-flagsConfigMap - Beta features enabled
Configuration
The Git Resolver uses thegit-resolver-config ConfigMap in the tekton-pipelines-resolvers namespace.
Configuration Options
default-revision
Default git revision if none specified (e.g.,
main)fetch-timeout
Maximum time for git clone operations (e.g.,
1m, 2s)default-url
Default repository URL for anonymous cloning
scm-type
SCM provider type for authenticated API (e.g.,
github, gitlab)server-url
SCM provider base URL for authenticated API
api-token-secret-name
Kubernetes secret containing the SCM API token
api-token-secret-key
Key within the token secret containing the token
default-org
Default organization for repositories
Caching Options
| Cache Value | Description |
|---|---|
always | Always cache resolved resources |
never | Never cache resolved resources |
auto | Cache only when revision is a commit hash (default) |
git-resolver-config ConfigMap:
Resolution Modes
The Git Resolver supports two modes:Git Clone Mode
Uses thego-git library to clone repositories. Supports anonymous and authenticated cloning.
Advantages:
- Not subject to API rate limits
- Higher throughput for repeated access
- Supports both anonymous and authenticated access
- Clones entire repository in memory
- Inefficient for large repositories
- Some commits may not be fetchable without branch/tag refs
Authenticated API Mode
Fetches individual files via SCM provider APIs (GitHub, GitLab, Gitea, BitBucket). Advantages:- Supports private repositories
- Fetches only the required file
- Efficient for large repositories
- Subject to API rate limits
- Requires authentication token
Usage Examples
Task Resolution with Git Clone
Task Resolution with Authenticated Git Clone
Task Resolution with Authenticated API
Task Resolution with Custom SCM Provider
Pipeline Resolution
Multiple Git Provider Configurations
You can configure multiple Git providers in the same ConfigMap using unique key prefixes:configKey parameter:
ResolutionRequest Status
TheResolutionRequest.Status.RefSource field captures source metadata:
uri
Git repository URL in SPDX download format
digest
Commit SHA (SHA-1 or SHA-256) of resolved revision
entrypoint
Path to the resource file in the repository
The Git Resolver supports both SHA-1 and SHA-256 commit hashes for revision validation. See the Git hash function transition for details.