{"id":20187498,"url":"https://github.com/bitrise-steplib/steps-git-clone","last_synced_at":"2025-07-03T22:38:00.603Z","repository":{"id":15960674,"uuid":"18703295","full_name":"bitrise-steplib/steps-git-clone","owner":"bitrise-steplib","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-14T07:17:02.000Z","size":6888,"stargazers_count":17,"open_issues_count":0,"forks_count":42,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-20T08:06:49.643Z","etag":null,"topics":["bitrise","bitrise-step","ci","hacktoberfest","production-code"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitrise-steplib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-04-12T12:12:28.000Z","updated_at":"2025-05-14T07:14:18.000Z","dependencies_parsed_at":"2024-03-14T13:29:24.491Z","dependency_job_id":"87afa1d0-34ad-4f80-a71f-0ec3d2987f87","html_url":"https://github.com/bitrise-steplib/steps-git-clone","commit_stats":null,"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"purl":"pkg:github/bitrise-steplib/steps-git-clone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-steplib%2Fsteps-git-clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-steplib%2Fsteps-git-clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-steplib%2Fsteps-git-clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-steplib%2Fsteps-git-clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitrise-steplib","download_url":"https://codeload.github.com/bitrise-steplib/steps-git-clone/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitrise-steplib%2Fsteps-git-clone/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263415912,"owners_count":23463109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bitrise","bitrise-step","ci","hacktoberfest","production-code"],"created_at":"2024-11-14T03:24:20.207Z","updated_at":"2025-07-03T22:38:00.569Z","avatar_url":"https://github.com/bitrise-steplib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Clone Repository\n\n[![Step changelog](https://shields.io/github/v/release/bitrise-steplib/steps-git-clone?include_prereleases\u0026label=changelog\u0026color=blueviolet)](https://github.com/bitrise-steplib/steps-git-clone/releases)\n\nChecks out the repository, updates submodules and exports git metadata as Step outputs.\n\n\u003cdetails\u003e\n\u003csummary\u003eDescription\u003c/summary\u003e\n\nThe checkout process depends on the Step settings and the build trigger parameters (coming from your git server).\n\nDepending on the conditions, the step can checkout:\n- the merged state of a Pull Request\n- the head of a Pull Request\n- a git tag\n- a specific commit on a branch\n- the head of a branch\n\nThe Step also supports more advanced features, such as updating submodules and sparse checkouts.\n\n### Configuring the Step\n\nThe step should work with its default configuration if build triggers and webhooks are set up correctly.\n\nBy default, the Step performs a shallow clone in most cases (fetching only the latest commit) to make the clone fast and efficient. If your workflow requires a deeper commit history, you can override this using the **Clone depth** input.\n\n### Useful links\n\n- [How to register a GitHub Enterprise repository](https://discuss.bitrise.io/t/how-to-register-a-github-enterprise-repository/218)\n- [Code security](https://devcenter.bitrise.io/getting-started/code-security/)\n\n### Related Steps\n\n- [Activate SSH key (RSA private key)](https://www.bitrise.io/integrations/steps/activate-ssh-key)\n- [Generate changelog](https://bitrise.io/integrations/steps/generate-changelog)\n\n\u003c/details\u003e\n\n## 🧩 Get started\n\nAdd this step directly to your workflow in the [Bitrise Workflow Editor](https://devcenter.bitrise.io/steps-and-workflows/steps-and-workflows-index/).\n\nYou can also run this step directly with [Bitrise CLI](https://github.com/bitrise-io/bitrise).\n\n## ⚙️ Configuration\n\n\u003cdetails\u003e\n\u003csummary\u003eInputs\u003c/summary\u003e\n\n| Key | Description | Flags | Default |\n| --- | --- | --- | --- |\n| `merge_pr` | This only applies to builds triggered by pull requests.  Options: - `yes`: Depending on the information in the build trigger, either fetches the PR merge ref or creates the merged state locally. - `no`: Checks out the head of the PR branch without merging it into the destination branch. |  | `yes` |\n| `clone_into_dir` | Local directory where the repository is cloned | required | `$BITRISE_SOURCE_DIR` |\n| `clone_depth` | Limit fetching to the specified number of commits.  By default, the Step tries to do a shallow clone (depth of 1) if it's possible based on the build trigger parameters. If it's not possible, it applies a low depth value, unless another value is specified here.  It's not recommended to define this input because a shallow clone ensures fast clone times. Examples of when you want to override the clone depth:  - A Step in the workflow reads the commit history in order to generate a changelog - A Step in the workflow runs a git diff against a previous commit  Use the value `-1` to disable the depth limit completely and fetch the entire repo history. |  |  |\n| `update_submodules` | Update registered submodules to match what the superproject expects. If set to `no`, `git fetch` calls will use the `--no-recurse-submodules` flag. |  | `yes` |\n| `submodule_update_depth` | When updating submodules, limit fetching to the specified number of commits. The value should be a decimal number, for example `10`. |  |  |\n| `fetch_tags` | yes - fetch all tags from the remote by adding `--tags` flag to `git fetch` calls no - disable automatic tag following by adding `--no-tags` flag to `git fetch` calls |  | `no` |\n| `sparse_directories` | Limit which directories to clone using [sparse-checkout](https://git-scm.com/docs/git-sparse-checkout). This is useful for monorepos where the current workflow only needs a subfolder.  For example, specifying `src/android` the Step will only clone: - contents of the root directory and - contents of the `src/android` directory and all of its subdirectories On the other hand, `src/ios` will not be cloned.  This input accepts one path per line, separate entries by a linebreak. |  |  |\n| `repository_url` | SSH or HTTPS URL of the repository to clone | required | `$GIT_REPOSITORY_URL` |\n| `commit` | Commit SHA to checkout |  | `$BITRISE_GIT_COMMIT` |\n| `tag` | Git tag to checkout |  | `$BITRISE_GIT_TAG` |\n| `branch` | Git branch to checkout |  | `$BITRISE_GIT_BRANCH` |\n| `branch_dest` | The branch that the pull request targets, such as `main` |  | `$BITRISEIO_GIT_BRANCH_DEST` |\n| `pull_request_repository_url` | URL of the source repository of a pull request.  This points to the fork repository in builds triggered by pull requests. |  | `$BITRISEIO_PULL_REQUEST_REPOSITORY_URL` |\n| `pull_request_merge_branch` | Git ref pointing to the result of merging the PR branch into the destination branch. Even if the source of the PR is a fork, this is a reference to the destination repository.  Example: `refs/pull/14/merge`  Note: not all Git services provide this value. |  | `$BITRISEIO_PULL_REQUEST_MERGE_BRANCH` |\n| `pull_request_unverified_merge_branch` | This input is the same as **Pull request merge ref**, but the provided merge ref can be potentially outdated. The Step will make an attempt to check it's validity and only use it for the checkout if it's up-to-date with the PR head. |  | `$BITRISEIO_PULL_REQUEST_UNVERIFIED_MERGE_BRANCH` |\n| `pull_request_head_branch` | Git ref pointing to the head of the PR branch. Even if the source of the PR is a fork, this is a reference to the destination repository.  Example: `refs/pull/14/head`  Note: not all Git services provide this value. |  | `$BITRISEIO_PULL_REQUEST_HEAD_BRANCH` |\n| `reset_repository` | Reset repository contents with `git reset --hard HEAD` and `git clean -f` before fetching. |  | `No` |\n| `build_url` | Unique build URL of this build on Bitrise.io |  | `$BITRISE_BUILD_URL` |\n| `build_api_token` | The build's API Token for the build on Bitrise.io | sensitive | `$BITRISE_BUILD_API_TOKEN` |\n| `git_http_username` | Username for establishing an HTTP(S) connection to the repository | sensitive | `$GIT_HTTP_USERNAME` |\n| `git_http_password` | Personal access token (or password) for establishing an HTTP(S) connection to the repository | sensitive | `$GIT_HTTP_PASSWORD` |\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eOutputs\u003c/summary\u003e\n\n| Environment Variable | Description |\n| --- | --- |\n| `GIT_CLONE_COMMIT_HASH` | SHA hash of the checked-out commit. |\n| `GIT_CLONE_COMMIT_MESSAGE_SUBJECT` | Commit message of the checked-out commit. |\n| `GIT_CLONE_COMMIT_MESSAGE_BODY` | Commit message body of the checked-out commit. |\n| `GIT_CLONE_COMMIT_COUNT` | Commit count after checkout.  Count will only work properly if no `--depth` option is set. If `--depth` is set then the history truncated to the specified number of commits. Count will **not** fail but will be the clone depth. |\n| `GIT_CLONE_COMMIT_AUTHOR_NAME` | Author of the checked-out commit. |\n| `GIT_CLONE_COMMIT_AUTHOR_EMAIL` | Email of the checked-out commit. |\n| `GIT_CLONE_COMMIT_COMMITTER_NAME` | Committer name of the checked-out commit. |\n| `GIT_CLONE_COMMIT_COMMITTER_EMAIL` | Email of the checked-out commit. |\n\u003c/details\u003e\n\n## 🙋 Contributing\n\nWe welcome [pull requests](https://github.com/bitrise-steplib/steps-git-clone/pulls) and [issues](https://github.com/bitrise-steplib/steps-git-clone/issues) against this repository.\n\nFor pull requests, work on your changes in a forked repository and use the Bitrise CLI to [run step tests locally](https://devcenter.bitrise.io/bitrise-cli/run-your-first-build/).\n\nLearn more about developing steps:\n\n- [Create your own step](https://devcenter.bitrise.io/contributors/create-your-own-step/)\n- [Testing your Step](https://devcenter.bitrise.io/contributors/testing-and-versioning-your-steps/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitrise-steplib%2Fsteps-git-clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitrise-steplib%2Fsteps-git-clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitrise-steplib%2Fsteps-git-clone/lists"}