# Private Data Repos and Observable

**URL:** <https://talk.observablehq.com/t/private-data-repos-and-observable/7081>\
**Category:** Help\
**Created:** [September 29, 2022, 9:20pm UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081 "2022-09-29T21:20:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachbogart](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/zachbogart/32/8597_2.png) [@zachbogart](https://talk.observablehq.com/u/zachbogart)\
**Post date:** [September 29, 2022, 9:20pm UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/1 "2022-09-29T21:20:16Z")

</div>

Hi there,

A problem I often face is getting data from a private repo into Observable. I’ll have a Bitbucket repo at work, with data wrangling of raw data for example, and I’ll want to pull in a cleaned data file to Observable for visualizing. I could download a version of it as a FileAttachment, but if/once it changes, I’ll need to rerun the script and update the attachment. I have seen in other notebooks examples of reading in files from Github links, like [using Apache Arrow](https://observablehq.com/@theneuralbit/introduction-to-apache-arrow) to access large datasets from a URL (awesome). This seems super helpful for accessing larger datasets than the FileAttachment size limit and being more explicit about where the data is coming from.

Can I get some schooling about working with data repos and Observable? Are there ways to connect to private repositories for smoother data updates? Should I be looking into some sort of external hosting of data that Observable can access? **If I do data wrangling in an external private repo, how would you suggest getting that data into Observable?**

Always learning,  
Zach

---

<div class="post-metadata">

**Author:** ![eagereyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/eagereyes/32/6255_2.png) [@eagereyes](https://talk.observablehq.com/u/eagereyes)\
**Post date:** [September 30, 2022, 12:20am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/2 "2022-09-30T00:20:37Z")

</div>

Hi Zach, you can use the github API to access files in private repos. Here’s [a good guide I found](https://observablehq.com/@asg017/github). You can store your API key as a secret in your account. You can only use them in private notebooks, but I assume that is what you’re after.

Is this what you were looking for?

---

<div class="post-metadata">

**Author:** ![zachbogart](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/zachbogart/32/8597_2.png) [@zachbogart](https://talk.observablehq.com/u/zachbogart)\
**Post date:** [September 30, 2022, 12:24am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/3 "2022-09-30T00:24:04Z")

</div>

This seems promising. Maybe a similar method can work for Bitbucket repos?

---

<div class="post-metadata">

**Author:** ![eagereyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/eagereyes/32/6255_2.png) [@eagereyes](https://talk.observablehq.com/u/eagereyes)\
**Post date:** [September 30, 2022, 12:31am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/4 "2022-09-30T00:31:29Z")

</div>

I would think so. [BitBucket has an API](https://developer.atlassian.com/cloud/bitbucket/rest/intro/) that looks like it has methods to access files.

One problem can be CORS, which is meant to protect you from cross-site scripting attacks, but in this case makes things unnecessarily difficult. There’s [a clever proxy](https://observablehq.com/@tomlarkworthy/fetchp) to work around that, though (not sure if you need it, but just in case).

---

<div class="post-metadata">

**Author:** ![tophtucker](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tophtucker/32/4781_2.png) [@tophtucker](https://talk.observablehq.com/u/tophtucker)\
**Post date:** [September 30, 2022, 1:17am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/5 "2022-09-30T01:17:08Z")

</div>

That seems like a good option. It also reminds me of our [self-hosted database proxy](https://github.com/observablehq/database-proxy). Similarly, you could run a web server on your local machine and fetch files from that in Observable. (@visnup just showed me this; we should write it up as a tutorial notebook.)

If you’re in Chrome or Edge, you can connect to your local computer directly over HTTP. Open a bash terminal and go to a folder with some data (e.g. I’ve got aapl.csv in there). Then run:

```auto
npx http-server --cors

```

It’ll tell you your local IP, and then you can run in a notebook:

```javascript
fetch("http://127.0.0.1:8080/aapl.csv").then((resp) => resp.text())

```

If you’re in Safari or Firefox, you have to connect over HTTPS. You can install ngrok in the terminal:

```auto
brew install ngrok

```

And then, with http-server still running, run:

```auto
ngrok http 8080

```

And it’ll give you a forwarding address you can use in the notebook to get your local files over HTTPS, something like:

```javascript
fetch("https://b701-125-211-126-202.ngrok.io/aapl.csv").then(resp => resp.text())

```

With the ngrok approach, other people can also access your files with that forwarding address, at least until you quit ngrok. (It’ll give you a different address every time.)

---

<div class="post-metadata">

**Author:** ![zachbogart](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/zachbogart/32/8597_2.png) [@zachbogart](https://talk.observablehq.com/u/zachbogart)\
**Post date:** [September 30, 2022, 2:40am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/6 "2022-09-30T02:40:22Z")

</div>

Nice, I’ll have to check this stuff out. We’re certainly getting into territory I find hard to follow, so tutorial notebooks appreciated!

@tophtucker would all of this be much easier/already possible if it was a public repo? In my head it would be really helpful to point to a file in a repo and download it via a URL, then could update the repo file without having to alter the Observable data connections. Sounds like the private nature introduces more challenges.

---

<div class="post-metadata">

**Author:** ![tophtucker](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tophtucker/32/4781_2.png) [@tophtucker](https://talk.observablehq.com/u/tophtucker)\
**Post date:** [September 30, 2022, 7:19am UTC](https://talk.observablehq.com/t/private-data-repos-and-observable/7081/7 "2022-09-30T07:19:22Z")

</div>

I can improve this but as a placeholder, little video demo here: [Fetch a local file from a notebook / Toph Tucker / Observable](https://observablehq.com/@tophtucker/fetch-a-local-file-from-a-notebook)
