* fix(pull): keep the local config.yaml when a later pull brings a tracked copy #357 refuses a root-scope first pull when the remote tracks config.yaml, but once upstream is set, a pull that merges in a remote-tracked copy still replaced this machine's config: Git treats the ignored file as expendable. Snapshot config.yaml around later pulls (CLI pull, push --pull, and the dashboard), restore it, and warn so the user can untrack it with push. Refs #353 * fix(git): untrack config.yaml after push --pull and warn on identical copies push --pull ran the root safety sweep before integrating the remote, so a pull that brought in a remote-tracked config.yaml was pushed back as-is: the remote kept tracking it and the next first pull elsewhere was refused. Re-run EnsureConfigUntracked after the pull and commit the removal before pushing. The warning also depended on the pull changing the local bytes, so a tracked copy identical to this machine's went unreported. KeepLocalConfig's restore now reports whether the repo tracks config.yaml after the pull. * fix(git): only restore config.yaml when the pull could have touched it KeepLocalConfig wrote its snapshot back after every root-scope pull, so an edit made to an untracked config.yaml while the pull ran was silently replaced by the stale copy. Git only rewrites config.yaml when it is tracked before or after the pull, so restore only in that case. * fix(git): restore config.yaml only when the pull changed its index entry Gating the restore on "tracked before or after" still overwrote edits made during a pull when config.yaml was already tracked and the pull left it alone. Compare config.yaml's index entry (mode, blob, stage) before and after the pull instead; a merge, reset or conflict that touches the file changes it, and anything else keeps the current file. * fix(git): warn about a tracked config.yaml only when the upstream tracks it The warning followed the local index, so a config.yaml tracked only by a local, unpushed commit was reported as tracked by the remote, and the suggested push would publish it in history. Check the upstream tree with RemoteTracksConfig("@{u}") instead. * fix(git): restore config.yaml after a pull that aborts its merge A merge that brought in a tracked config.yaml and conflicted elsewhere was aborted, which deleted the file again and returned the index entry to its pre-pull state, so restore saw no change and the local config was lost. Also restore when the snapshotted file is missing after the pull. * fix(git): keep config.yaml ignored when a later rule negates it EnsureConfigUntracked only checked that a "config.yaml" line existed, so a pulled .gitignore with a later "!config.yaml" left the file unignored and the following `git add -A` tracked this machine's copy again. Check the effective ignore state and append an overriding entry when needed. * fix: commit post-pull .gitignore repairs and keep config.yaml's mode push --pull committed only when EnsureConfigUntracked removed an index entry, so a pulled .gitignore that stopped ignoring config.yaml was repaired locally but never pushed, leaving the tree dirty. Commit whenever the safety step leaves changes. KeepLocalConfig skipped the restore when the bytes matched, so a checkout that rewrote config.yaml with the default mode dropped this machine's restrictive permissions. Compare the mode too, and chmod after writing since WriteFile's mode is masked by umask. * fix(git): restore config.yaml over a tracked config.yaml directory A pull that checks out a tracked config.yaml/ tree replaces the ignored local file with a directory, which os.Remove cannot delete, so restore failed and the local config stayed lost. Remove a directory there before writing the snapshot back; its contents are in Git. EnsureConfigUntracked now untracks recursively so push can remove that tree too. * fix: keep post-checkout config edits and preview .gitignore repairs Restore wrote the snapshot back whenever the pull changed config.yaml's index entry, even when a newer copy had been written after Git checked it out. Skip the restore when the file on disk no longer matches the blob the pull checked out. A dry-run push or commit only previewed untracking config.yaml, so when a later "!config.yaml" rule un-ignored it the preview listed config.yaml to commit while a real run repairs .gitignore instead. Preview that repair. * fix: scope the post-pull safety commit and keep post-checkout symlinks The post-pull safety step in push --pull ran `git add -A`, so an edit made by another process while the pull ran was committed and pushed under the config-safety message. Stage only .gitignore on top of the config.yaml removal and commit the index as staged. The post-checkout edit check skipped symlinks, so a dotfiles manager that replaced config.yaml with a newer link after the checkout had it replaced by the stale snapshot. Treat a link where Git checked out a file, or a different link target, as a newer local edit. * fix: preview explicit config.yaml entries and refuse other .gitignore edits A dry run previewed the .gitignore repair only when config.yaml was not ignored at all, but a real run also appends the explicit entry when a broader rule such as *.yaml ignores it. Preview whenever the entry is missing too. The post-pull safety commit staged the whole .gitignore, so an edit made by another process while the pull ran was pushed with it. Refuse unless the file only gained config.yaml lines over its staged version. * fix: report config.yaml restore failures instead of dropping them integrateRemote declared the KeepLocalConfig result with :=, shadowing the named err that the deferred restore joins its failure into, so a failed restore was swallowed and pull or push --pull went on to sync targets with another machine's config.yaml. The dashboard pull replaced the pull's own error with a bare 500 on a restore failure, losing the conflict response and the ops log entry; join the errors so both are reported.
5.4 KiB
sidebar_position
| sidebar_position |
|---|
| 2 |
pull
Pull from git remote and sync to all targets.
skillshare pull # Pull and sync
skillshare pull --dry-run # Preview
skillshare pull --force # Replace local with remote on first pull
When to Use
- Sync skills from another machine that pushed changes
- Get the latest skills after someone else pushed updates
- Start working on a new machine after
init --remote
What Happens
flowchart TD
CMD["skillshare pull"]
CHECK["1. Check repository status"]
PULL["2. Pull from remote"]
SYNC["3. Sync to all targets"]
CMD --> CHECK --> PULL --> SYNC
Options
| Flag | Description |
|---|---|
--dry-run, -n |
Preview without making changes |
--force, -f |
On first pull conflict, replace local skills with remote |
Git Root Scope
pull operates on the directory selected by the git_root config field (default: skills source). See commit — Git Root Scope for the scope table. If git_root was changed but the git repo still lives in another scope's directory, pull prints a "Git root mismatch" error with the exact git init / mv commands to fix it. See Changing the scope after init.
After pulling, pull syncs what the scope holds: skills runs sync, agents runs sync agents, extras runs sync extras, and root runs all three.
Plugins, MCP servers and hooks are settings in config.yaml, which no scope tracks, so pull neither brings nor applies them. See Cross-Machine Sync — Plugins, MCP and Hooks.
Prerequisites
Your source directory must be a git repository with a remote:
# Check if ready:
skillshare status
# Shows: Git: initialized with remote
Local Changes Warning
If you have uncommitted changes, pull will fail:
$ skillshare pull
✗ Local changes detected
Run: skillshare push
Or: cd ~/.config/skillshare/skills && git stash -u
Solutions:
# Option 1: Commit locally first, without pushing
skillshare commit -m "Local changes"
skillshare pull
# Option 2: Push your changes first
skillshare push
skillshare pull
# Option 3: Stash your changes
cd ~/.config/skillshare/skills
git stash
skillshare pull
git stash pop
When Both Machines Committed
If this machine has commits the remote lacks and the remote has commits this machine lacks, pull merges the two histories into a merge commit, then syncs. Push afterwards to share the merge.
Both machines rewrite .metadata.json whenever they install or update a skill, so it often conflicts. pull resolves those conflicts on its own: each skill's entry is merged separately, and when both machines changed the same entry, the one with the later installed_at wins.
A conflict in any other file stops the pull, undoes the merge, and names the files:
$ skillshare pull
✗ git pull failed
pull stopped: this machine and the remote both changed my-skill/SKILL.md; the merge was undone, resolve it with git in ~/.config/skillshare/skills
The repository is left as it was before the pull. To resolve the conflict yourself:
cd ~/.config/skillshare/skills
git pull --no-rebase # redo the merge and keep the conflicts
# edit the conflicted files, then
git add . && git commit --no-edit
skillshare push
skillshare sync
First Pull with Existing Skills
On first pull (no upstream yet), if the local repository already holds content (any directory, or any tracked or non-ignored file other than .gitignore),
pull attempts a merge to combine both sides. If the merge succeeds, both local and remote content is preserved. Only a repository with nothing else is reset to the remote branch.
At git_root: root, config.yaml is machine-specific. If the remote repository tracks config.yaml, a first pull refuses with an error so local configuration is never overwritten. Untrack config.yaml on the remote first (via skillshare push on the machine that tracks it) before pulling. Later pulls keep this machine's config.yaml and warn instead; run skillshare push to remove it from the remote.
If there are merge conflicts, pull fails with a non-zero exit code:
$ skillshare pull
✗ Pull failed
Resolve manually: cd ~/.config/skillshare/skills && git merge --allow-unrelated-histories <remote branch>
Or force-pull: skillshare pull --force (replaces local with remote)
Resolve options:
# Resolve conflicts manually, then push
cd ~/.config/skillshare/skills
git add . && git commit
skillshare push
# Or discard local and take remote
skillshare pull --force
Examples
# Standard pull (most common)
skillshare pull
# Preview what would happen
skillshare pull --dry-run
# Replace local with remote on first-pull conflict
skillshare pull --force
Workflow
Typical workflow on a secondary machine:
# Start of day: get latest skills
skillshare pull
# ... work with AI tools ...
# End of day: share any new skills
skillshare collect claude # If you created new skills
skillshare push -m "Add new skill"
See Also
- commit — Commit locally without pushing
- push — Push to remote
- sync — Manual sync without pull
- Cross-Machine Sync — Full setup