Context
We use Obsidian with the vault shared from a Git repository as our internal knowledge base solution at where I work. Windows users have been plagued with a perplexing bug that results in unexplained changes to markdown files when triggered.
It seems that a feasible workaround has been discovered so I’m sharing it here for posterity.
Problem Description
Under conditions that are difficult to replicate/understand, rendering some notes in Obsidian results in the underlying markdown file being modified in some way.
- The behavior manifests only with Obsidian on Windows
- Occurs sporadically
-
git diff
reveals no changes in the file - MD5 hashes show file as unchanged
- Regardless, Git believes that unstaged changes exist
- Detailed listing of the file on Linux reveals that the last modified timestamp has been altered
- A Stack Overflow posting led me to this page, which made me think this could be why Git interprets the file as changed
- Google then led me to discovering the Git
trustctime
configuration
Environmental Considerations
- Our shared vault is hosted in a private GitLab repository.
- I’ve developed a custom Go application to configure installations for internal users, including Git.
- Obsidian-Git is being used to pull/push files from a central repository.
- The repository is being share between Linux, Mac, and Windows hosts.
Workarounds
We appear to have corrected the issue by applying the following settings to the local git configuration file:
core.autocrlf=true
core.trustctime=false
That is, the [core]
section of the repository’s .git\config
file is:
[core]
bare = false
autocrlf = true
trustctime = false