{"id":15285920,"url":"https://github.com/zyj1022/git-get-repo","last_synced_at":"2026-01-04T23:06:28.976Z","repository":{"id":57686524,"uuid":"479220914","full_name":"zyj1022/git-get-repo","owner":"zyj1022","description":"Download and extract a git repository (GitHub, GitLab, Bitbucket, Gitee) from node","archived":false,"fork":false,"pushed_at":"2022-04-08T02:47:26.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T05:51:32.957Z","etag":null,"topics":["bitbucket","git","github","gitlab"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/git-get-repo","language":"TypeScript","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/zyj1022.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}},"created_at":"2022-04-08T02:45:36.000Z","updated_at":"2023-03-08T02:52:23.000Z","dependencies_parsed_at":"2022-09-14T07:11:50.195Z","dependency_job_id":null,"html_url":"https://github.com/zyj1022/git-get-repo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyj1022%2Fgit-get-repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyj1022%2Fgit-get-repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyj1022%2Fgit-get-repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zyj1022%2Fgit-get-repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zyj1022","download_url":"https://codeload.github.com/zyj1022/git-get-repo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168912,"owners_count":20571804,"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":["bitbucket","git","github","gitlab"],"created_at":"2024-09-30T15:08:28.495Z","updated_at":"2026-01-04T23:06:23.933Z","avatar_url":"https://github.com/zyj1022.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-get-repo\n\n- Download and extract a git repository (GitHub, GitLab, Bitbucket, Gitee) from node.\n- [TSDX](https://tsdx.io/) development, add Gitee support\n- Fork by [download-git-repo](https://gitlab.com/flippidippi/download-git-repo)\n\n## Installation\n\n```\n  npm install git-get-repo\n```\n\n## API\n\n### download(repository, destination, options, callback)\n\nDownload a git `repository` to a `destination` folder with `options`, and `callback`.\n\n#### repository\nThe shorthand repository string to download the repository from:\n\n- **GitHub** - `github:owner/name` or simply `owner/name`\n- **GitLab** - `gitlab:owner/name`\n- **Bitbucket** - `bitbucket:owner/name`\n- **Gitee** - `gitee:owner/name`\n\nThe `repository` parameter defaults to the `master` branch, but you can specify a branch or tag as a URL fragment like `owner/name#my-branch`.\nIn addition to specifying the type of where to download, you can also specify a custom origin like `gitlab:custom.com:owner/name`.\nCustom origin will default to `https` or `git@` for http and clone downloads respectively, unless protocol is specified.\nFeel free to submit an issue or pull request for additional origin options.\n\nIn addition to having the shorthand for supported git hosts, you can also hit a repository directly with:\n\n- **Direct** - `direct:url`\n\nThis will bypass the shorthand normalizer and pass `url` directly.\nIf using `direct` without clone, you must pass the full url to the zip file, including paths to branches if needed.\nIf using `direct` with clone, you must pass the full url to the git repo and you can specify a branch like `direct:url#my-branch`.\n\n#### destination\nThe file path to download the repository to.\n\n#### options\nAn optional options object parameter with download options. Options include:\n\n- `clone` - boolean default `false` - If true use `git clone` instead of an http download. While this can be a bit slower, it does allow private repositories to be used if the appropriate SSH keys are setup.\n- All other options (`proxy`, `headers`, `filter`, etc.) will be passed down accordingly and may override defaults\n    - Additional download options: https://github.com/kevva/download#options\n    - Additional clone options: https://github.com/jaz303/git-clone#clonerepo-targetpath-options-cb\n\n#### callback\nThe callback function as `function (err)`.\n\n## Examples\n### Shorthand\nUsing http download from Github repository at master.\n```javascript\ndownload('owner/git-get-repo-fixture', 'test/tmp', function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing git clone from Bitbucket repository at my-branch.\n```javascript\ndownload('bitbucket:owner/git-get-repo-fixture#my-branch', 'test/tmp', { clone: true }, function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing http download from GitLab repository with custom origin and token.\n```javascript\ndownload('gitlab:mygitlab.com:owner/git-get-repo-fixture#my-branch', 'test/tmp', { headers: { 'PRIVATE-TOKEN': '1234' } } function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing git clone from GitLab repository with custom origin and protocol.\nNote that the repository type (`github`, `gitlab` etc.) is not required if cloning from a custom origin.\n\n```javascript\ndownload('https://mygitlab.com:owner/git-get-repo-fixture#my-branch', 'test/tmp', { clone: true }, function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing git clone from Gitee repository with custom origin and protocol.\n\n```javascript\ndownload('https://gitee.com:owner/git-get-repo-fixture#my-branch', 'test/tmp', { clone: true }, function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n### Direct\n\nUsing http download from direct url.\n```javascript\ndownload('direct:https://gitlab.com/owner/git-get-repo-fixture/repository/archive.zip', 'test/tmp', function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing git clone from direct url at master.\n```javascript\ndownload('direct:https://gitlab.com/owner/git-get-repo-fixture.git', 'test/tmp', { clone: true }, function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\nUsing git clone from direct url at my-branch.\n```javascript\ndownload('direct:https://gitlab.com/owner/git-get-repo-fixture.git#my-branch', 'test/tmp', { clone: true }, function (err) {\n  console.log(err ? 'Error' : 'Success')\n})\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyj1022%2Fgit-get-repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzyj1022%2Fgit-get-repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzyj1022%2Fgit-get-repo/lists"}