Second Brain in a GitHub Repo: Setup and Trade-Offs
Set up a second brain in a private GitHub repo in six steps, with Obsidian Git, agent rules and a monthly restore test. Plus the limits on mobile and files.
The Short Version
- Turn your notes folder into a private GitHub repo in six steps, with GitHub Desktop and no commands.
- The Obsidian Git plugin commits, pulls and pushes on a schedule you set.
- Version history brings back a note you or an agent deleted months ago.
- GitHub blocks files over 100 MiB and recommends repos under 1 GB.
- Make agents propose changes in a pull request you review before anything lands.
On this page
- Version History Gives Notes an Undo, a Record and Agent Access
- Six Steps Put Your Second Brain in a GitHub Repo
- Version History Brings Back a Note You Deleted Last Month
- Commit Messages That Say Why Turn History Into a Decision Log
- Agents Should Propose Changes, Never Save Them Straight to Your Notes
- Give Every Writer in Your Second Brain GitHub Repo Its Own Folder
- Run the Laptop Loss Test Once a Month
- Mobile Is the Weakest Part of a Git Vault
- Attachments Hit GitHub's Size Limits First
- A Private Repo Still Lives on Someone Else's Server
- A Git Vault Is the Wrong Choice in Two Cases
- Pull Requests Let You Review What Agents Write
- Start With One Saved Version Today
- Questions and Answers
You open an old note and half of it is gone. A second brain GitHub repo fixes that. It is a private repository of Markdown notes with full version history. You get a record of every change, an undo for any edit, and a copy every AI agent can read.
Maybe you cut that note by mistake, or an AI tool tidied it up. Your notes app keeps only the latest version, so the old text is lost. The trade-offs of a repo show up on mobile, with large attachments, and in privacy.
I keep my own notes in a private GitHub repo. My test for the setup is blunt: I must be able to lose my laptop, set up a new one, and have every note back. The setup passes that test, with two limits I hit. If the term is new to you, read what a second brain is and how to build one first. Developers who keep work notes beside code can also read the developer notes repo use case.
Version History Gives Notes an Undo, a Record and Agent Access#
A plain folder of notes keeps only the latest version of each file. Git, the version system behind GitHub, keeps every version with a date and a short message. Three things follow from that.
- Undo. A bad edit, from you or an agent, can be reversed.
- Review. You see exactly what changed in a note, line by line.
- Access. Claude Code, Codex and other agents read the repo like any project.
Access matters most once you use agents. An agent reads the same notes you do, on any machine. It also reads a rules file at the top of the repo, called CLAUDE.md or AGENTS.md, and follows what you wrote there.
Six Steps Put Your Second Brain in a GitHub Repo#
The steps work for an Obsidian vault or any folder of Markdown files. The easiest path for a non-developer is GitHub Desktop, a free app with buttons instead of commands.
- Turn the folder into a repo. In GitHub Desktop, add your notes folder as a new local repository.
- List the files to skip. Obsidian saves your open tabs in files that change on every click. Tell git to ignore those workspace files, the trash folder and system clutter. Keep the rest of the Obsidian settings so your plugins travel with the vault.
- Save the first version. Commit every file with a message such as "First commit of my notes".
- Publish it as a private repo. Check the "Keep this code private" box before you publish. A public notes repo is easy to create by mistake.
- Sync on a schedule. You will forget to save versions by hand. The Obsidian Git plugin saves, pulls and pushes on a timer you set, and pulls when Obsidian starts. It also shows changes inside Obsidian.
- Give agents the rules. Add
CLAUDE.mdorAGENTS.mdat the top of the repo. Say what each folder holds, which notes to trust, and where agents may write. The free AGENTS.md generator builds one from a short form. The guides on giving Claude Code memory from your notes repo and AGENTS.md for a second brain go further.

Version History Brings Back a Note You Deleted Last Month#
The undo is the reason most people stay with git. Say you, or an agent, deleted a note last month and you need it back.
Open the repo history in GitHub Desktop or on github.com. Find the change that removed the note, then open the version just before it. Copy the note back, or restore the file from that point and save it as a new version. I tested a restore on a sample repo on 20 Nov 2026, and the note came back with its full text.
The same history shows how one note changed over time, even after you renamed it. Git's own documentation covers the commands if you prefer a terminal.
Commit Messages That Say Why Turn History Into a Decision Log#
A scheduled sync saves versions with a generic message. That message tells you when a note changed and never why. So add one hand-written commit on the days you change your mind.
The rule I use is simple. Let the timer save the small edits. Write the message yourself whenever a note changes a belief, a plan or a rule.
Example. Two histories for the same note, called "Pricing for workshops".
| Before, timer only | After, one written commit |
|---|---|
| vault backup, 12 Oct | vault backup, 12 Oct |
| vault backup, 3 Nov | Drop the early-bird price after the 3 Nov cohort sold out at full price |
| vault backup, 3 Nov | vault backup, 3 Nov |
Six months later the left column is noise. The right column answers the question you will actually ask: why did I change this? Search the history for "drop" or "after", and the decisions come back in order.
An agent gains from the same habit. Ask it to read the last 20 commit messages before it edits a note. It then learns which notes you changed on purpose and which ones only drifted.
Agents Should Propose Changes, Never Save Them Straight to Your Notes#
An agent that writes straight into your main notes skips your review. Put one rule in your agent file: work on a separate branch and open a pull request.
A branch is a side copy of your notes. A pull request is a page on GitHub that lists every change the agent wants to make. You read it, then merge it or close it. A closed pull request leaves your notes untouched.
Give Every Writer in Your Second Brain GitHub Repo Its Own Folder#
Each tool that writes to the repo should own one folder, and only you should own the rest. Then a glance at the changed paths tells you who wrote what.
| Writer | Where it may write | How you check it |
|---|---|---|
| You | Every folder | Your own commits |
| A coding agent such as Claude Code | An inbox folder, on a branch | A pull request you merge |
| A newsletter tool | Its own named folder | A pull request you merge |
| A meeting recorder | A meetings folder | A weekly skim of new files |
| Any tool | Never your rules file or your about-me notes | Write this ban into the rules file |
Write the table into your CLAUDE.md or AGENTS.md in plain sentences. The workshop template I give attendees has the same idea in one line: new information lands in the inbox first, and moves only after review.
The common mistake is one shared "AI notes" folder for every tool. Within a month you cannot tell the meeting summaries from the agent drafts, so you trust none of them. One folder per writer fixes that, and deleting a tool means deleting one folder.
Run the Laptop Loss Test Once a Month#
A backup you never restored is a hope. My rule for every repo I own is blunt: I must be able to lose this laptop, clone the repo on a new machine, and have everything work. A git vault makes that test take five minutes, so run it monthly.
- Clone the repo somewhere new. Use a second computer, or a fresh folder on the same one.
- Open that copy as a vault in Obsidian. Your plugins and settings should load, because you kept the Obsidian settings folder.
- Find a note you edited this week. If it is missing, your sync stopped and nobody told you.
- Check the date of the last version on github.com. It should be less than a day old on any day you wrote.
- Open one attachment. A broken image means the file sat outside the repo or over a size limit.
Step 3 catches the quiet failure. A sync plugin can stop after an expired sign-in, and the vault keeps working on your laptop. You only notice on the day the laptop dies.
Mobile Is the Weakest Part of a Git Vault#
Git on a phone is hard. The Obsidian Git README says the plugin is highly unstable on mobile, and the author does not recommend it there. Mobile also lacks SSH sign-in, and large repos may crash Obsidian.
So decide where you edit. If 90 percent of your notes start on a laptop, git fits. If most start on a phone, pair git with a sync service built for mobile, and let the laptop save the versions.
Two devices also raise conflicts. Edit the same note on two machines before either syncs, and git asks you to merge the two versions. Sync before you edit. The plugin's pull on startup handles most of this.
Attachments Hit GitHub's Size Limits First#
Text notes stay small for years, because each one takes a few kilobytes. Images, PDFs and audio grow a repo.
GitHub's large file docs set these limits:
| Limit | Size |
|---|---|
| Git warns on a file over | 50 MiB |
| GitHub blocks a file over | 100 MiB |
| Upload through the browser | 25 MiB |
| Recommended repo size | Under 1 GB, strongly recommended under 5 GB |
Three habits keep a vault inside them:
- Compress screenshots before you paste them.
- Keep large PDFs and recordings in cloud storage, and link to them from the note.
- Use Git LFS, GitHub's large file add-on, only for a file over 100 MiB.
A Private Repo Still Lives on Someone Else's Server#
A private repo hides your notes from the public. It does not keep them off GitHub's servers. Every app you grant access to the repo can read them too.
Sort your notes before the first upload. Keep passwords, ID numbers, and health and money records out of the repo. Write that rule into your agent file as well, so an agent never copies those notes into another tool.
Give each app the narrowest access. GitHub lets you limit a token to one repository and one permission. Revoke access you stop using.
A Git Vault Is the Wrong Choice in Two Cases#
Git fits people who write on a laptop and keep mostly text. Pick a different setup if either case below is yours.
- Most notes start on your phone. The Obsidian Git author does not recommend the plugin on mobile, so a mobile sync service fits better.
- The vault is mostly media. Recordings and scans hit the 100 MiB block and the 1 GB guideline long before text does.
Pull Requests Let You Review What Agents Write#
The review rule matters more as more tools write to your notes. A meeting recorder, a newsletter agent and a coding agent can all write to the same repo. A pull request from each one shows you exactly what it wants to change. The post on reviewing notes like code in pull requests covers the habit.
Brainfeed is built around this flow. It adds accepted newsletter ideas under a brainfeed/ folder and sends them as one pull request you merge.
Example. This is demo content, not a logged run. An issue argues that agents should never write to your main notes directly. Your repo holds a note called "Agent testing", so the card reads "builds on Agent testing". You accept it. The pull request adds one new note that links to yours, and your notes change only when you merge.
Start With One Saved Version Today#
Run steps 1 to 4 on your vault. It takes a few minutes, and from then on every change has a history.
Once the repo is on GitHub, run the free Brainfeed scan on it. Your browser reads up to 40 notes and ranks 41 newsletters against them.
Then hand the weekly reading to Brainfeed. It labels each idea against your notes, waits for your swipe, and writes only what you accept, in its own folder. Your first pull request is free. Starter is $9 for your first month, then $19, at brainfeed.atharvashah.com/#join.
Questions and Answers#
- Should I keep my Obsidian vault in a GitHub repo?
- Yes, if you work on a laptop and want history, undo and agent access. Git records every change, so a bad edit is one revert away, and Claude Code or Codex can clone the repo. Skip it if you edit mostly on a phone, because the Obsidian Git plugin warns that it is unstable on mobile.
- How do I sync Obsidian with GitHub?
- Turn the vault folder into a repo with GitHub Desktop, skip the Obsidian workspace files, save a first version, and publish it as a private repo. Then install the Obsidian Git community plugin. It syncs on a schedule and pulls when Obsidian starts, so the repo stays current without typing commands.
- Is a private GitHub repo safe for personal notes?
- A private repo is visible only to you and the people you invite, but the files sit on GitHub's servers. Keep passwords, ID numbers and health or money records out of it, or in a separate store. Any app or token you grant repo access can also read the notes.
- How big can a notes repo on GitHub get?
- GitHub recommends keeping a repository under 1 GB, and strongly recommends under 5 GB. Git warns on files over 50 MiB, and GitHub blocks files over 100 MiB. Text notes stay tiny for years. Images and PDFs are what push a vault toward those limits.
- Is GitHub free for a private notes repo?
- Yes. GitHub's Free plan lists unlimited public and private repositories, so a private notes repo costs nothing. Git LFS, the add-on for files over 100 MiB, is a paid extra. A vault of text notes and compressed screenshots stays far below the limits where that add-on matters.
- Can AI agents work with a second brain in a GitHub repo?
- Yes. Claude Code, Codex and similar agents read and write files in a copy of the repo, and they read a CLAUDE.md or AGENTS.md rules file at its top. Ask agents to open a pull request, so you review their changes before they reach your main notes.
Read Next#
- How to Give Claude Code Memory From Your Notes RepoGive Claude Code memory from a notes repo: a CLAUDE.md under 200 lines, a folder map, frontmatter on every note, and path rules that load only when needed.
- AGENTS.md for a Second Brain: What to Put in ItWhat to put in AGENTS.md for a second brain: a folder map, trust levels, note format, write rules an agent can check, answer rules, and an access key per agent.
- How to Forward Newsletters Into a GitHub Repo of NotesThree tested ways to get newsletters into a GitHub repo as Markdown: a weekly GitHub Action for RSS, an email Worker that commits each issue, or email-to-feed.
- Review Notes Like Code With Pull RequestsLet AI write to your notes only through a pull request. Set up the repo, the folder rule, the marked block and branch protection, then review each diff.
Keep the Best Ideas From Every Newsletter
Paste a GitHub repo of Markdown notes. The free scan shows which of 41 newsletters fit what you already know.
No account needed. Your first pull request is free.
ExampleFrom a newsletter issue
Small teams now ship with one agent per repo.
Builds on agents.md