···11-# pds-git-remote
11+# git-remote-pds
2233This is not the most efficient way to do git,
44and is not meant as a replacement for [tangled](https://tangled.org/),
55-or for anything really.
55+or for anything really.
6677However it seems to work, and it can be used by anyone with a PDS or a bluesky account,
88without installing anything additionally on their server.
991010Tangled currently requires the use of a [knot server](https://tangled.org/tangled.org/core/blob/8dd9e59b99e83e757bcadf11a4bda31fc78e6732/docs/knot-hosting.md)
1111as well as the use of ssh keys for git access
1212-(although from talking with the developers, there is some discussion of
1313-changing things in the future to allow authentication without ssh keys). pds-git-remote skips these requirements as well as efficiency.
1212+(although from talking with the developers, there is some discussion of
1313+changing things in the future to allow authentication without ssh keys). git-remote-pds skips these requirements as well as efficiency.
14141515-pds-git-remote is a git remote helper that stores repositories on an [AT Protocol](https://atproto.com) Personal Data Server (PDS) directly.
1515+git-remote-pds is a git remote helper that stores repositories on an [AT Protocol](https://atproto.com) Personal Data Server (PDS) directly.
1616```bash
1717-# log in to your PDS
1818-git-remote-pds auth login --pds-url https://your-pds.example.com --handle alice.example.com
1717+# log in to your PDS via OAuth (opens browser)
1818+git-remote-pds auth oauth-login --handle alice.example.com
19192020# push an existing repo
2121cd my-project
···32323333- I have done basic tests to confirm that it works,
3434- the design and code could be reviewed
3535-- haven't done any benchmarking
3535+- haven't done any benchmarking
36363737-This was actually created as a subtask for a mostly unrelated project (more soon).
3737+This was actually created as a subtask for a mostly unrelated project (more soon).
38383939## git-ssb <3
40404141primary inspiration was git-ssb. another tool that may
4242-not have been the most efficient way to do git,
4242+not have been the most efficient way to do git,
4343but I really loved for multiple reasons ([link](https://scuttlebot.io/apis/community/git-ssb.html))
44444545···5252# add the binary to your PATH
5353export PATH="$(pwd)/target/debug:${PATH}"
54545555-# log in to your PDS
5656-git-remote-pds auth login --pds-url https://your-pds.example.com --handle alice.example.com
5555+# log in to your PDS (opens browser for authorization)
5656+git-remote-pds auth oauth-login --handle alice.example.com
57575858# push an existing repo
5959cd my-project
···83838484## Authentication
85858686-### `auth login`
8686+git-remote-pds supports two ways to authenticate with a PDS. Credentials are stored per-handle in `~/.config/pds-git-remote/auth.json`. If you have multiple accounts, each handle has its own credential — git-remote-pds uses the matching handle from the `pds://handle/repo` URL.
8787+8888+### OAuth login (recommended)
8989+9090+```bash
9191+git-remote-pds auth oauth-login --handle alice.example.com
9292+```
9393+9494+Opens your browser to authorize with your PDS via AT Protocol OAuth. This uses the loopback client flow (no server required) and stores DPoP-bound tokens locally. Tokens are short-lived (~5 minutes) but include a refresh token for renewal.
9595+9696+For a PDS that isn't discoverable via handle resolution (e.g. local dev), pass `--pds-url`:
9797+9898+```bash
9999+git-remote-pds auth oauth-login --handle alice.example.com --pds-url https://your-pds.example.com
100100+```
101101+102102+The `--port` flag controls which localhost port the OAuth callback listens on (default: 8271).
103103+104104+### Password login
8710588106```bash
89107git-remote-pds auth login --pds-url https://your-pds.example.com --handle alice.example.com
90108```
911099292-Prompts for your password and stores credentials in `~/.config/pds-git-remote/auth.json`.
110110+Authenticates with handle + password via `com.atproto.server.createSession` and stores a Bearer token. This is simpler but requires your password (or an app password), and AT Protocol is moving toward deprecating password-based auth in favor of OAuth.
9311194112### `auth status`
95113···97115git-remote-pds auth status
98116```
99117100100-Shows stored credentials.
118118+Shows stored credentials, auth method, and token status:
119119+120120+```
121121+alice.example.com
122122+ did: did:plc:abc123
123123+ pds: https://pds.example.com
124124+ auth: OAuth (DPoP)
125125+ token: valid (expires in 3m 20s)
126126+127127+bob.example.com
128128+ did: did:plc:def456
129129+ pds: https://other-pds.example.com
130130+ auth: createSession (Bearer)
131131+```
101132102133### `auth logout`
103134···111142112143| Variable | Description |
113144|----------|-------------|
114114-| `PDS_HANDLE` + `PDS_PASSWORD` | Log in on the fly |
115115-| `PDS_ACCESS_TOKEN` + `PDS_DID` | Use a token directly |
145145+| `PDS_HANDLE` + `PDS_PASSWORD` | Log in on the fly via createSession |
146146+| `PDS_ACCESS_TOKEN` + `PDS_DID` | Use a token directly (Bearer) |
147147+| `PDS_ACCESS_TOKEN` + `PDS_DID` + `PDS_DPOP_KEY` | Use a DPoP-bound token directly |
116148| `PDS_URL` | Override PDS endpoint (skips identity resolution) |
149149+150150+Environment variables take priority over stored credentials.
117151118152## Identity resolution
119153···135169# e2e tests (used via scripts with docker, see below)
136170cargo test --features e2e
137171```
172172+173173+### Playwright tests (OAuth flow)
174174+175175+End-to-end tests for the OAuth login and push flow using Playwright:
176176+177177+```bash
178178+./playwright-test/run.sh
179179+```
180180+181181+Tests `oauth-login` with browser automation, then pushes and clones to verify.
138182139183### Local PDS (Docker)
140184