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: src/dotfiles-sync/README.md
+10-27Lines changed: 10 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Dotfiles Sync (dotfiles-sync)
2
2
3
-
Syncs local Git, SSH, GPG, npm, gh, cargo, pip, yarn/pnpm config files into the devcontainer. Optionally syncs cloud credentials (AWS, kube, Docker, gh OAuth token) β opt-in only. Works on macOS, Linux, Windows (WSL and native), GitHub Codespaces, Gitpod, and DevPod. Uses a **merge strategy** for established files and a **copy-if-absent** strategy for new ones β never overwrites existing values, safe alongside cloud platform native auth and GPG signing.
3
+
Syncs local Git, SSH, GPG, npm, and yarn config files into the devcontainer. Optionally syncs cloud credentials (AWS, kube, Docker) β opt-in only. Works on macOS, Linux, Windows (WSL and native), GitHub Codespaces, Gitpod, and DevPod. Uses a **merge strategy** for established files and a **copy-if-absent** strategy for new ones β never overwrites existing values, safe alongside cloud platform native auth and GPG signing.
4
4
5
5
## Usage
6
6
@@ -33,7 +33,6 @@ That's it. The feature auto-detects the environment and adapts its behavior.
|`syncGhAuth`| boolean |`false`| Copy `~/.config/gh/hosts.yml` (GitHub OAuth token used by `gh` CLI) into the container's `$HOME`. Skipped on cloud environments (Codespaces / Gitpod / DevPod inject their own token). When `false`, the file is bind-mounted into `/mnt/h4dotfiles` (Feature `mounts` cannot be conditional) but **never copied** to `$HOME` and never read by anything else. Prefer the [`github-dev`](../github-dev/) feature with `GH_TOKEN` for fine-grained PATs. |
37
36
|`syncAwsConfig`| boolean |`false`| Sync `~/.aws/config` (profiles only β `~/.aws/credentials` is **never** synced). |
38
37
|`syncKubeConfig`| boolean |`false`| Sync `~/.kube/config` (cluster credentials and tokens). Skipped on cloud environments. |
|`~/.config/pip/pip.conf`|`~/.config/pip/pip.conf`| Copy-if-absent | pip index URLs |
60
54
61
55
### Opt-in (sensitive)
62
56
57
+
**Operational note β bind-mounts are unconditional:** DevContainer Feature `mounts` cannot be gated on option values. The files below are always bind-mounted into `/mnt/h4dotfiles` at container start, regardless of the option value. The option only controls whether `sync-files.sh` copies the staged file into `$HOME`. Consequences:
58
+
59
+
-**Startup failure risk** β Docker file bind-mounts fail hard if the source path does not exist on the host. If you don't have `~/.aws/config`, `~/.kube/config`, or `~/.docker/config.json`, the container will fail to start even if the corresponding option is `false`. Create the file (it can be empty) to unblock startup.
60
+
-**Data visible in staging** β even when the option is `false`, the host file is accessible inside the container at `/mnt/h4dotfiles/<path>`. Nothing reads that path unless the option is enabled, but if your threat model requires full isolation, do not use the feature for that credential.
61
+
63
62
| Local Path | Option | Notes |
64
63
|------------|--------|-------|
65
-
|`~/.config/gh/hosts.yml`|`syncGhAuth`| GitHub OAuth token used by `gh`. The file is bind-mounted into `/mnt/h4dotfiles` unconditionally (Feature `mounts` cannot be gated on options) but **only copied to `$HOME` when `syncGhAuth: true`**. Skipped on cloud environments. For fine-grained PATs, prefer [`github-dev`](../github-dev/) + `GH_TOKEN`. |
66
64
|`~/.aws/config`|`syncAwsConfig`| AWS profiles. `~/.aws/credentials` (long-lived access keys) is **not bind-mounted** and never synced. |
67
65
|`~/.kube/config`|`syncKubeConfig`| Kubernetes cluster credentials. Skipped on cloud environments. |
68
66
|`~/.docker/config.json`|`syncDockerConfig`| Docker registry auth tokens. Skipped on cloud environments. |
@@ -74,7 +72,7 @@ That's it. The feature auto-detects the environment and adapts its behavior.
74
72
75
73
## GitHub authentication
76
74
77
-
`gh` CLI authentication is **off by default**. Pick whichever fits your workflow:
75
+
`gh` CLI authentication is not managed by this feature. Pick whichever fits your workflow:
78
76
79
77
1.**`github-dev` feature + `GH_TOKEN`** (recommended for fine-grained scope):
80
78
@@ -90,23 +88,7 @@ That's it. The feature auto-detects the environment and adapts its behavior.
90
88
}
91
89
```
92
90
93
-
2.**Sync your local `gh auth login` token** (`syncGhAuth: true`):
The token is copied with `chmod 600` and only if `~/.config/gh/hosts.yml` does not already exist in the container. Skipped on Codespaces / Gitpod / DevPod (the platform injects its own token).
106
-
107
-
**Security note** β because DevContainer Feature `mounts` cannot be conditional on options, `~/.config/gh/hosts.yml` is bind-mounted into `/mnt/h4dotfiles/.config/gh/hosts.yml` whether or not you opt in. Nothing reads that path unless `syncGhAuth: true`, but if your threat model considers any in-container exposure unacceptable, use approach 1 or 3 instead.
108
-
109
-
3.**`gh auth login` inside the container** β token stays in the container only.
91
+
2.**`gh auth login` inside the container** β token stays in the container only.
110
92
111
93
## Merge Strategy
112
94
@@ -118,7 +100,7 @@ That's it. The feature auto-detects the environment and adapts its behavior.
118
100
|`.ssh/known_hosts`| Appends host entries not already present |
119
101
|`.ssh` keys | Copies files only if destination does not exist |
120
102
|`.gnupg`| Copied on local/WSL; **skipped on cloud environments** (see below) |
121
-
| All other files (gitignore_global, gh/config.yml, cargo, pip, yarn, pnpm, β¦) |**Copy-if-absent** β never overwrites an existing target |
103
+
| All other files (git/ignore, git/attributes, yarnrc.yml, β¦) |**Copy-if-absent** β never overwrites an existing target |
122
104
123
105
### Cloud environment protection
124
106
@@ -253,6 +235,7 @@ ssh-add -l
253
235
254
236
## Version History
255
237
238
+
-**v1.0.4**: Removed bind-mounts for files that are frequently absent on host machines and have little value inside a devcontainer: `~/.gitignore_global` (redundant with `~/.config/git/` directory mount), `~/.config/pnpm/rc` (pnpm store-dir is counter-productive in a container), `~/.config/gh/config.yml` and `~/.config/gh/hosts.yml` (gh CLI auth managed separately), `~/.cargo/config.toml` (cargo not relevant in most containers), `~/.config/pip/pip.conf` (too environment-specific). Docker file bind-mounts fail hard if the source path doesn't exist on the host, which was causing containers to fail to start. The `syncGhAuth` option is removed.
256
239
-**v1.0.3**: Fixed incompatibility with `docker-in-docker` feature β staging directory moved from `/tmp/dotfiles-sync/` to `/mnt/h4dotfiles/` to avoid being hidden by the tmpfs that `docker-in-docker` mounts on `/tmp` at container start.
257
240
-**v1.0.2**: Added `syncGhAuth` opt-in to copy `~/.config/gh/hosts.yml` (GitHub OAuth token used by `gh` CLI) into `$HOME`. Default `false`, skipped on cloud environments. The file is bind-mounted into `/tmp/dotfiles-sync/` regardless (Feature `mounts` cannot be conditional) but only copied to `$HOME` when the option is enabled. For fine-grained PATs prefer the `github-dev` feature with `GH_TOKEN`.
258
241
-**v1.0.1**: Stop bind-mounting the `~/.config/gh` directory. Only `~/.config/gh/config.yml` (CLI preferences) is mounted. Added 3 opt-in booleans for sensitive files: `syncAwsConfig`, `syncKubeConfig`, `syncDockerConfig` β all default `false` and skipped on cloud environments. Added low-risk dotfiles (gitignore_global, git/ignore, git/attributes, yarnrc.yml, pnpm/rc, cargo/config.toml, pip/pip.conf) with copy-if-absent strategy. `~/.aws/credentials` is never bind-mounted.
"description": "Username in the container that should receive synchronized local config files"
12
12
},
13
-
"syncGhAuth": {
14
-
"type": "boolean",
15
-
"default": false,
16
-
"description": "Sync ~/.config/gh/hosts.yml (GitHub OAuth token used by gh CLI). Skipped on cloud environments (Codespaces/Gitpod/DevPod inject their own token). Prefer the github-dev feature with GH_TOKEN for fine-grained PATs."
0 commit comments