{"id":21865240,"url":"https://github.com/gildas/git-credential-bitbucket","last_synced_at":"2025-04-14T21:03:42.557Z","repository":{"id":55535484,"uuid":"257159309","full_name":"gildas/git-credential-bitbucket","owner":"gildas","description":"GIT credential helper for OAuth on Bitbucket Cloud","archived":false,"fork":false,"pushed_at":"2024-07-16T13:38:09.000Z","size":181,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T11:17:37.850Z","etag":null,"topics":["bitbucket","credential-storage","git","oauth"],"latest_commit_sha":null,"homepage":null,"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/gildas.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":"2020-04-20T03:16:18.000Z","updated_at":"2024-10-01T02:48:49.000Z","dependencies_parsed_at":"2024-06-20T04:44:10.095Z","dependency_job_id":"b2819fa4-c57b-4499-889e-1ea440340b14","html_url":"https://github.com/gildas/git-credential-bitbucket","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgit-credential-bitbucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgit-credential-bitbucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgit-credential-bitbucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gildas%2Fgit-credential-bitbucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gildas","download_url":"https://codeload.github.com/gildas/git-credential-bitbucket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961198,"owners_count":21189991,"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","credential-storage","git","oauth"],"created_at":"2024-11-28T04:15:16.314Z","updated_at":"2025-04-14T21:03:42.529Z","avatar_url":"https://github.com/gildas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-credential-bitbucket\n\nThis is a git credential store for bitbucket's OAUTH.  \n\nIt can be used with git remotes when neither the ssh protocol nor the basic authentication are available. Typically, the bitbucket account/repo has been configure to use OAUTH.\n\n## Pre-requisites\n\nYou will need to create a bitbucket consumer to be able to use this credential store. See https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html.  \nMake sure you create a **private** consumer so you can use the `client_credentials` OAUTH grant type (the Callback URL can be a dummy).  \nAs for the permissions, you need to give **admin** permissions to `repositories` and **write** to `Pull requests`.\n\nOnce created, collect the **key** and the **secret** from the consumer (click on the consumer name on the OAuth page)\n\n## Installation\n\n### Binaries\n\nDownload the binary for your platform from the [releases](https://github.com/gildas/git-credential-bitbucket/releases) page.\n\nUnzip it and copy the executable in a folder that belongs to your `PATH`.\n\n### Source\n\nGet the source by cloning this repository and run:  \n```console\nmake install\n```\n\nBy default the binary is installed in `/usr/local/bin`. You can choose another folder as long as it belongs to your `PATH` environment variable.\n\n## Usage\n\n### Adding credentials\n\nYou can add credentials by running the git credential tools:  \n```console\ngit credential-bitbucket store \u003c\u003cEOM\nprotocol=https\nhost=bitbucket.org\nusername=xxx\nclientid=yyy\nsecret=zzz\n```\n\nWhere:  \n- `xxx` is your username on bitbucket.org,\n- `yyy` is the **key** you collected in the Pre-requisites,\n- `zzz` is the **secret** you collected in the Pre-requisites.\n\n### Using the credential store\n\nIn the git repository clone on your machine, make sure the remote repository is something like:\n```console\ngit remote add bitbucket https://xxx@bitbucket.org/path/to/repo.git\n```\n\nWhere `xxx` is your username on bitbucket.org (or at least the same username you used to store the credentials).\n\nThen, add the credential helper:\n\n```console\ngit config credential.helper bitbucket\n```\n\nNow, the next time you do a `git pull`, `git push` on that remote repository, the credential helper will manage the OAUTH token for you.\n\n### Removing credentials\n\nIf for any reason, you don't need the credentials anymore, you can simply run:  \n```console\ngit credential-bitbucket erase \u003c\u003cEOM\nprotocol=https\nhost=bitbucket.org\nusername=xxx\n```\n\nWhere `xxx` is your username on bitbucket.org (or at least the same username you used to store the credentials).\n\n### Advanced usage\n\n#### Store location\n\nBy default, the credential store is stored in `$XDG_DATA_HOME/git-credential-bitbucket` (we follow the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html))\n\nThe folder used can be changed with:  \n- the environment variable `STORE_LOCATION`,\n- the command line argument `--store-location`.\n\nExample:  \n```console\ngit config credential.helper \"bitbucket --store-location /path/to/location\"\n```\n\n**Note:** Make sure the store is readable only by yourself as it will contain sensible information.\n\n#### Bitbucket Workspaces\n\nIf your account is used in various Bitbucket workspaces you can store per-workspace credentials:  \n```console\ngit credential-bitbucket --workspace MyTeam store \u003c\u003cEOM\nprotocol=https\nhost=bitbucket.org\nusername=xxx\nclientid=yyy\nsecret=zzz\n```\n\nAnd you would configure the helper in git as follows:  \n```console\ngit config credential.helper \"bitbucket --workspace MyTeam\"\n```\n\n#### Token Renewal\n\nBy default, the credential store will try to renew the bitbucket's OAUTH token 10 minutes before it expires.\n\nThis can be changed with:  \n- the environment variable `RENEW_BEFORE`,\n- the command line argument `--renew`.\n\nExample, to renew 20 minutes before the token expire:  \n```console\ngit config credential.helper \"bitbucket --renew 20m\"\n```\n\n#### Logging\n\nIf, for any reason, you need to analyze what happens when the credential store is used, you can add logging:  \n```console\ngit config credential.helper \"bitbucket --log /path/to/log/credentials.log\"\n```\nThe log is stored using the [gildas/go-logger](https://github.com/gildas/go-logger) format and can be (pretty) read with [bunyan](https://github.com/trentm/node-bunyan).\n\n**Note:** the logs can contain ids and passwords.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgildas%2Fgit-credential-bitbucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgildas%2Fgit-credential-bitbucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgildas%2Fgit-credential-bitbucket/lists"}