- Notes only: ignore the entire
.obsidian/directory and configure plugins separately on each device. - Share selected settings: track the configuration you have reviewed while ignoring workspace state and sensitive plugin data.
- Already tracked files: new ignore rules do not stop tracking them or remove earlier copies from history.
A vault is a folder of files. Your ignore policy determines which untracked files Git offers to add; it is not a privacy scanner or an encryption setting. Review the staged diff before committing. GitSync.md’s automatic publication can stage all non-ignored edits, making these choices especially important.
Option 1: sync notes and keep settings local
Create a file named .gitignore in the vault’s repository root. Use this starter when you want notes and attachments in Git, with Obsidian configuration kept per device:
# Obsidian configuration stays on each device
.obsidian/
# Deleted notes and operating-system metadata
.trash/
.DS_Store
Thumbs.db
This excludes the entire default configuration directory, including plugin installation and settings. You will install and configure community plugins separately on desktop and mobile. Ignoring trash also means deleted notes there will not be included in future commits; retain an independent backup.
Option 2: share reviewed settings
If you deliberately want some configuration files in Git, replace the notes-only example with a policy such as this. Do not combine it with the broad .obsidian/ exclusion above and expect settings to sync.
# Keep window layouts device-specific
.obsidian/workspace.json
.obsidian/workspace-mobile.json
# Configure community plugins separately
.obsidian/plugins/
.obsidian/community-plugins.json
.trash/
.DS_Store
Thumbs.db
Other files under the default .obsidian/ directory can now be tracked. Review them for private content and differences between devices before adding them. If you use a custom configuration directory, adapt the paths. There is no universal list of plugin files that is safe for every vault.
Excluding a plugin’s files does not disable the plugin in the copy already on your device. It changes what new files Git tracks. Existing tracked files require a separate decision.
Where these rules apply
Place the file at the repository root for the examples here, with the vault at that same root. A nested vault needs paths relative to the repository layout. Keep the repository’s .git directory intact; adding it to an ignore file is not a way to sync Git metadata between apps.
A committed .gitignore travels with the repository. Git’s .git/info/exclude provides local-only exclusions. GitSync.md’s Publish a Folder flow can use local exclusions for files you left unselected; those rules do not automatically cover every file you create later. See Git’s ignore-rule documentation.
Check the rules before pushing
In GitSync.md, review the changed-file list and staged diff. On desktop, run these from the repository root; the paths below assume the example settings files exist:
git status --short
git check-ignore -v .obsidian/workspace.json
git ls-files -- .obsidian
git check-ignore -v reports the matching rule for an ignored, untracked path. No match is not proof a file is safe. git ls-files shows settings already tracked in the index. See the check-ignore reference for diagnostic behavior.
Commit the policy, push, and pull on the other device. Then check both devices’ staged changes. Confirm that a normal note still appears in Git while unwanted workspace state does not.
Why ignored files still appear
Gitignore rules apply to untracked files. If a settings file was committed earlier, adding its path to .gitignore does not stop tracking it. Plan any tracking removal with copies of the local settings on each device; a committed deletion can remove that tracked file from another working copy when pulled.
Do not delete your configuration or run a broad index-reset command just to quiet the change list. Decide which exact files should remain versioned, then review the resulting commit. GitHub’s ignore guide explains the tracked-file distinction.
If a token or private file was committed
Adding an ignore rule or making a later deletion commit does not erase earlier revisions. Revoke or rotate an exposed credential first. Then assess repository history, other clones, and remote copies using GitHub’s sensitive-data removal guidance.
A private repository still has a provider and authorized readers. If notes need encryption where the service cannot read them, compare Obsidian Sync and Git before choosing your storage model.
