You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/connections/bitbucket-data-center.mdx
+65-29Lines changed: 65 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,35 +68,71 @@ If you're not familiar with Sourcebot [connections](/docs/connections/overview),
68
68
69
69
## Authenticating with Bitbucket Data Center
70
70
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
+
<Tabtitle="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
+
<Tabtitle="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>
100
136
101
137
## Troubleshooting
102
138
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