[Bug]: Obsidian Git should not list/stage/commit files outside the vault

Author: m-thomsonCreated Sep 5, 2026Updated Sep 18, 2026
Labelsbug

Describe the bug

When the Obsidian vault is a subdirectory of a larger Git repository, Obsidian Git operates on the entire repository rather than only the vault.

Example:

repo/
├── src/
├── package.json
└── docs/   ← Obsidian vault

Changes in src/ and other files outside docs/ appear in Source Control and may be staged/committed by Obsidian Git.

This is surprising and unsafe for an Obsidian plugin. Supporting a vault inside a parent Git repo should not imply managing unrelated files outside the vault.

Expected behavior: Git status/staging/commits should be scoped to the vault path, e.g.:

bash
git status -- docs/
git add -A -- docs/

Current version: 2.39.0

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

bash

Steps to reproduce

  • Create a repo
  • Inside a subfolder create an Obsidian Vault.
  • Add or edit a repo file that is not in the Obsidian vault
  • Obsidian git lists that file

Expected Behavior

Obsidian Git should only operate on the files within the Obsidian vault.

Addition context

Debug info below. Note basePath = '..'

{
    "settings": {
        "commitMessage": "vault backup: {{date}}",
        "autoCommitMessage": "vault backup: {{date}}",
        "commitMessageScript": "",
        "commitDateFormat": "YYYY-MM-DD HH:mm:ss",
        "autoSaveInterval": 0,
        "autoPushInterval": 0,
        "autoPullInterval": 0,
        "autoPullOnBoot": false,
        "autoCommitOnlyStaged": false,
        "disablePush": false,
        "pullBeforePush": true,
        "squashCommitsBeforePush": false,
        "disablePopups": false,
        "showErrorNotices": true,
        "disablePopupsForNoChanges": false,
        "listChangedFilesInMessageBody": false,
        "showStatusBar": true,
        "updateSubmodules": false,
        "syncMethod": "merge",
        "mergeStrategy": "none",
        "customMessageOnAutoBackup": false,
        "autoBackupAfterFileChange": false,
        "treeStructure": false,
        "refreshSourceControl": true,
        "basePath": "..",
        "differentIntervalCommitAndPush": false,
        "changedFilesInStatusBar": false,
        "showedMobileNotice": true,
        "refreshSourceControlTimer": 7000,
        "showBranchStatusBar": true,
        "setLastSaveToLastCommit": false,
        "submoduleRecurseCheckout": false,
        "gitDir": "",
        "showFileMenu": true,
        "authorInHistoryView": "hide",
        "dateInHistoryView": false,
        "diffStyle": "split",
        "hunks": {
            "showSigns": false,
            "hunkCommands": false,
            "statusBar": "disabled"
        },
        "lineAuthor": {
            "show": false,
            "followMovement": "inactive",
            "authorDisplay": "initials",
            "showCommitHash": false,
            "dateTimeFormatOptions": "date",
            "dateTimeFormatCustomString": "YYYY-MM-DD HH:mm",
            "dateTimeTimezone": "viewer-local",
            "coloringMaxAge": "1y",
            "colorNew": {
                "r": 255,
                "g": 150,
                "b": 150
            },
            "colorOld": {
                "r": 120,
                "g": 160,
                "b": 255
            },
            "textColorCss": "var(--text-muted)",
            "ignoreWhitespace": false,
            "lastShownAuthorDisplay": "initials",
            "lastShownDateTimeFormatOptions": "date"
        }
    },
    "pluginVersion": "2.39.0"
}

### Operating system

macOS

### Installation Method

None

### Plugin version

2.39.0