Skip to content

Commit 711dbfe

Browse files
docs: update Bitbucket Data Center authentication docs with token type tabs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e7667a4 commit 711dbfe

File tree

1 file changed

+65
-29
lines changed

1 file changed

+65
-29
lines changed

docs/docs/connections/bitbucket-data-center.mdx

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,71 @@ If you're not familiar with Sourcebot [connections](/docs/connections/overview),
6868

6969
## Authenticating with Bitbucket Data Center
7070

71-
In order to index private repositories, you'll need to provide an access token to Sourcebot via a [token](/docs/configuration/config-file#tokens).
72-
73-
Create an access token for the desired scope (repo, project, or workspace). Visit the official [Bitbucket Data Center docs](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html)
74-
for more info.
75-
76-
1. Add the `token` property to your connection config:
77-
78-
```json
79-
{
80-
"type": "bitbucket",
81-
"deploymentType": "server",
82-
"url": "https://mybitbucketdeployment.com",
83-
"token": {
84-
// note: this env var can be named anything. It
85-
// doesn't need to be `BITBUCKET_TOKEN`.
86-
"env": "BITBUCKET_TOKEN"
87-
}
88-
// .. rest of config ..
89-
}
90-
```
91-
92-
2. Pass this environment variable each time you run Sourcebot:
93-
94-
```bash
95-
docker run \
96-
-e BITBUCKET_TOKEN=<ACCESS_TOKEN> \
97-
/* additional args */ \
98-
ghcr.io/sourcebot-dev/sourcebot:latest
99-
```
71+
In order to index private repositories, you'll need to provide a [HTTP Access Token](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html). Tokens can be scoped to a user account, a project, or an individual repository.
72+
73+
<Tabs>
74+
<Tab title="User account token">
75+
User account tokens grant access to all repositories the user can access. Because these are tied to a specific user account, you must also set the `user` field to that user's username.
76+
77+
1. In Bitbucket Data Center, navigate to your profile → **Manage account****HTTP access tokens** and click **Create token**. Give it a name and grant it **Project read** and **Repository read** permissions.
78+
79+
2. Add the `user` (your Bitbucket username) and `token` properties to your connection config:
80+
81+
```json
82+
{
83+
"type": "bitbucket",
84+
"deploymentType": "server",
85+
"url": "https://mybitbucketdeployment.com",
86+
"user": "myusername",
87+
"token": {
88+
// note: this env var can be named anything. It
89+
// doesn't need to be `BITBUCKET_TOKEN`.
90+
"env": "BITBUCKET_TOKEN"
91+
}
92+
// .. rest of config ..
93+
}
94+
```
95+
96+
3. Pass this environment variable each time you run Sourcebot:
97+
98+
```bash
99+
docker run \
100+
-e BITBUCKET_TOKEN=<ACCESS_TOKEN> \
101+
/* additional args */ \
102+
ghcr.io/sourcebot-dev/sourcebot:latest
103+
```
104+
</Tab>
105+
<Tab title="Project / repository token">
106+
Project and repository tokens are scoped to a specific project or repository.
107+
108+
1. In Bitbucket Data Center, navigate to the project or repository → **Settings****HTTP access tokens** and click **Create token**. Give it a name and grant it **Repository read** and **Project read** permissions.
109+
110+
2. Add the `token` property to your connection config:
111+
112+
```json
113+
{
114+
"type": "bitbucket",
115+
"deploymentType": "server",
116+
"url": "https://mybitbucketdeployment.com",
117+
"token": {
118+
// note: this env var can be named anything. It
119+
// doesn't need to be `BITBUCKET_TOKEN`.
120+
"env": "BITBUCKET_TOKEN"
121+
}
122+
// .. rest of config ..
123+
}
124+
```
125+
126+
3. Pass this environment variable each time you run Sourcebot:
127+
128+
```bash
129+
docker run \
130+
-e BITBUCKET_TOKEN=<ACCESS_TOKEN> \
131+
/* additional args */ \
132+
ghcr.io/sourcebot-dev/sourcebot:latest
133+
```
134+
</Tab>
135+
</Tabs>
100136

101137
## Troubleshooting
102138
If you're seeing errors like `TypeError: fetch failed` when fetching repo info, it may be that Sourcebot is refusing to connect to your self-hosted Bitbucket instance due to unrecognized SSL certs. Try setting the `NODE_TLS_REJECT_UNAUTHORIZED=0` environment variable or providing Sourcebot your certs through the `NODE_EXTRA_CA_CERTS` environment variable.

0 commit comments

Comments
 (0)