{"id":18651191,"url":"https://github.com/sargunv/git-credentials","last_synced_at":"2026-04-12T07:39:08.868Z","repository":{"id":65816786,"uuid":"600550527","full_name":"sargunv/git-credentials","owner":"sargunv","description":"Library to access the git credential API by wrapping the git credential command.","archived":false,"fork":false,"pushed_at":"2023-06-06T02:22:27.000Z","size":1358,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-27T22:32:51.228Z","etag":null,"topics":["git","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sargunv.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}},"created_at":"2023-02-11T20:49:24.000Z","updated_at":"2023-02-13T07:44:13.000Z","dependencies_parsed_at":"2024-11-07T06:48:55.415Z","dependency_job_id":"f3e5eb7e-29ea-44ad-9c41-089ac62b6847","html_url":"https://github.com/sargunv/git-credentials","commit_stats":{"total_commits":53,"total_committers":3,"mean_commits":"17.666666666666668","dds":"0.30188679245283023","last_synced_commit":"49c21cff674a40d631e5c022f762e9525b7aaa04"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sargunv/git-credentials","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sargunv%2Fgit-credentials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sargunv%2Fgit-credentials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sargunv%2Fgit-credentials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sargunv%2Fgit-credentials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sargunv","download_url":"https://codeload.github.com/sargunv/git-credentials/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sargunv%2Fgit-credentials/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31707953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T06:22:27.080Z","status":"ssl_error","status_checked_at":"2026-04-12T06:21:52.710Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","nodejs","typescript"],"created_at":"2024-11-07T06:48:49.785Z","updated_at":"2026-04-12T07:39:08.833Z","avatar_url":"https://github.com/sargunv.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM](https://img.shields.io/npm/v/git-credentials)](https://www.npmjs.com/package/git-credentials)\n[![CI](https://img.shields.io/github/actions/workflow/status/sargunv/git-credentials/ci.yml)](https://github.com/sargunv/git-credentials/actions/workflows/ci.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/sargunv/git-credentials?token=WEHUGPYIIX)](https://app.codecov.io/gh/sargunv/git-credentials/)\n[![License](https://img.shields.io/npm/l/git-credentials)](https://github.com/sargunv/git-credentials/blob/main/LICENSE)\n[![Node](https://img.shields.io/node/v/git-credentials)](https://github.com/sargunv/git-credentials/blob/main/package.json)\n[![ESM](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/sargunv/git-credentials/blob/main/package.json)\n\n# git-credentials\n\nThis library wraps the `git credential` command to make it easy to interact with\nthe git-credential API. It requires `git` to be installed and available in the\n`PATH`.\n\nOne common use case is to automagically extract the user's saved GitHub token to\nuse in a tool that interacts with the GitHub API.\n\nFor more details, read the [git credential documentation][git-credential].\n\n## Usage\n\nAll `gitCredential*` functions have a `cwd` option to set the working directory\nwhere the `git credential` commands will be run.\n\n### git credential fill\n\nFrom the [git-credential documentation][git-credential]:\n\n\u003e If the action is `fill`, git-credential will attempt to add \"username\" and\n\u003e \"password\" attributes to the description by reading config files, by\n\u003e contacting any configured credential helpers, or by prompting the user.\n\n```ts\nimport { gitCredentialFill } from \"git-credentials\"\n\nawait gitCredentialFill(\n  {\n    protocol: \"https\",\n    host: \"example.com\",\n    path: \"example/repo.git\", // optional\n    username: \"example-username\", // optional\n  },\n  {\n    // optional but recommended, sets GIT_ASKPASS\n    askpass: \"true\",\n  },\n)\n```\n\nThe above example will return:\n\n```js\n{\n  protocol: 'https',\n  host: 'example.com',\n  username: 'example-username',\n  password: 'example-password'\n}\n```\n\nThis function has some additional options:\n\n- `askpass: string`\n  - Sets [`GIT_ASKPASS`][git-env-askpass]. If not provided, it'll be inherited\n    from the environment. I recommend setting it to `true` (a command that does\n    nothing and exits with code 0) unless you want the user to be prompted for\n    their credentials in certain contexts (for example in a VSCode terminal). If\n    unset, `gitCredentialFill` will throw when `git` fails to fill a password.\n- `terminalPrompt: boolean`\n  - Sets [`GIT_TERMINAL_PROMPT`][git-env-terminal-prompt]. If not provided,\n    it'll be inherited from the environment. If `GIT_ASKPASS` is set and\n    successful, git will not show the prompt regardless of this setting.\n\n### git credential approve\n\nFrom the [git-credential documentation][git-credential]:\n\n\u003e If the action is `approve`, git-credential will send the description to any\n\u003e configured credential helpers, which may store the credential for later use.\n\n```mjs\nimport { gitCredentialApprove } from \"git-credentials\"\n\nawait gitCredentialApprove({\n  protocol: \"https\",\n  host: \"example.com\",\n  path: \"example/repo.git\", // optional\n  username: \"example-username\",\n  password: \"example-password\",\n})\n```\n\n### git credential reject\n\nFrom the [git-credential documentation][git-credential]:\n\n\u003e If the action is `reject`, git-credential will send the description to any\n\u003e configured credential helpers, which may erase any stored credential matching\n\u003e the description.\n\n```mjs\nimport { gitCredentialReject } from \"git-credentials\"\n\nawait gitCredentialReject({\n  protocol: \"https\",\n  host: \"example.com\",\n  path: \"example/repo.git\", // optional\n  username: \"example-username\",\n  password: \"example-password\",\n})\n```\n\n[git-credential]: https://git-scm.com/docs/git-credential\n[git-env-askpass]:\n  https://git-scm.com/docs/git#Documentation/git.txt-codeGITASKPASScode\n[git-env-terminal-prompt]:\n  https://git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsargunv%2Fgit-credentials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsargunv%2Fgit-credentials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsargunv%2Fgit-credentials/lists"}