{"id":51069166,"url":"https://github.com/codybontecou/gitsync.md","last_synced_at":"2026-06-23T09:01:35.196Z","repository":{"id":337337637,"uuid":"1153131963","full_name":"CodyBontecou/GitSync.md","owner":"CodyBontecou","description":"Markdown notes synced with Git — a native iOS \u0026 iPadOS app that turns any GitHub repository into a synced markdown vault.","archived":false,"fork":false,"pushed_at":"2026-06-09T22:01:13.000Z","size":144708,"stargazers_count":9,"open_issues_count":13,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T23:19:45.418Z","etag":null,"topics":["git","github","ios","libgit2","markdown","obsidian","swift","swiftui"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodyBontecou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-08T23:51:07.000Z","updated_at":"2026-06-09T22:01:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/CodyBontecou/GitSync.md","commit_stats":null,"previous_names":["codybontecou/sync.md","codybontecou/gitsync.md"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodyBontecou/GitSync.md","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyBontecou%2FGitSync.md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyBontecou%2FGitSync.md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyBontecou%2FGitSync.md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyBontecou%2FGitSync.md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodyBontecou","download_url":"https://codeload.github.com/CodyBontecou/GitSync.md/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyBontecou%2FGitSync.md/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34682633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","github","ios","libgit2","markdown","obsidian","swift","swiftui"],"created_at":"2026-06-23T09:01:32.475Z","updated_at":"2026-06-23T09:01:35.191Z","avatar_url":"https://github.com/CodyBontecou.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitSync.md\n\n**Markdown notes synced with Git** — a native iOS \u0026 iPadOS app that turns any GitHub repository into a synced markdown vault.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"screenshots/02-login.png\" width=\"200\" /\u003e\n  \u003cimg src=\"screenshots/04-home-both-cloned.png\" width=\"200\" /\u003e\n  \u003cimg src=\"screenshots/03-blog-cloned.png\" width=\"200\" /\u003e\n\u003c/p\u003e\n\n## What It Does\n\nGitSync.md clones GitHub repos directly to your iPhone or iPad using [libgit2](https://libgit2.org), giving you a real `.git` directory on the device filesystem. Edit markdown files with any app — [Obsidian](https://obsidian.md), ia Writer, or the built-in Files app — then pull and push changes back to GitHub.\n\n**Key features:**\n\n- **Real git** — Clone, pull, commit, and push via libgit2. No REST API workarounds, no proprietary sync.\n- **Multiple repos** — Manage several GitHub repositories at once.\n- **Custom save locations** — Store repos anywhere accessible via the Files app.\n- **Obsidian integration** — Works with Obsidian vaults via `x-callback-url` for automated sync.\n- **GitHub OAuth \u0026 PAT** — Sign in with GitHub OAuth or paste a Personal Access Token.\n- **Private repo support** — Works with both public and private repositories.\n- **iPad support** — Optimized layouts for iPad.\n\n## How It Works\n\n1. **Sign in** with GitHub (OAuth or Personal Access Token)\n2. **Pick a repository** from your GitHub account (or add one manually)\n3. **Clone** it to your device — files appear in the iOS Files app\n4. **Edit** with any markdown editor\n5. **Pull** to fetch remote changes, **Push** to commit and upload yours\n\nFiles live under `On My iPhone › GitSync.md` by default, or in a custom location you choose.\n\n## Architecture\n\n```\nGitSync.md/\n├── Sync.md/                    # iOS app source\n│   ├── Sync_mdApp.swift        # App entry point\n│   ├── ContentView.swift       # Root view router\n│   ├── Models/\n│   │   ├── AppState.swift      # Observable app state (repos, auth, sync)\n│   │   ├── RepoConfig.swift    # Repository configuration model\n│   │   └── GitState.swift      # Git state persistence\n│   ├── Views/\n│   │   ├── SetupView.swift     # Onboarding \u0026 sign-in\n│   │   ├── RepoListView.swift  # Home screen — repo cards\n│   │   ├── VaultView.swift     # Single repo — pull/push/status\n│   │   ├── AddRepoView.swift   # Add new repository flow\n│   │   ├── RepoPickerView.swift # GitHub repo browser\n│   │   ├── SettingsView.swift  # Per-repo settings\n│   │   ├── GitControlSheet.swift # Commit message \u0026 push sheet\n│   │   └── Theme.swift         # Design system (colors, gradients, glass cards)\n│   └── Services/\n│       ├── LocalGitService.swift    # libgit2 wrapper (clone/pull/push/status)\n│       ├── GitHubService.swift      # GitHub REST API client\n│       ├── OAuthService.swift       # GitHub OAuth via ASWebAuthenticationSession\n│       ├── KeychainService.swift    # Secure token storage\n│       └── CallbackURLHandler.swift # x-callback-url handler (Obsidian integration)\n├── Packages/\n│   └── Clibgit2/               # Swift package wrapping the libgit2 C library\n├── oauth-server/               # Vercel serverless functions for GitHub OAuth\n│   └── api/auth/               # Login \u0026 callback endpoints\n└── libgit2.xcframework/        # Pre-built libgit2 binary for iOS\n```\n\n### Git Implementation\n\nAll git operations use **libgit2** directly via C interop — no shelling out, no REST API tree manipulation. The `LocalGitService` wraps libgit2 to provide:\n\n- **Clone** — `git_clone` with HTTPS credential callback\n- **Pull** — Fetch + fast-forward merge\n- **Commit \u0026 Push** — Stage all changes, create commit, push to remote\n- **Status** — Uncommitted change detection via `git_status_list`\n\nThis produces a standard `.git` directory, making repos compatible with other git tools like the [Obsidian Git](https://github.com/Vinzent03/obsidian-git) plugin.\n\n### x-callback-url API\n\nExternal apps can trigger sync operations via URL scheme:\n\n```\nsyncmd://x-callback-url/\u003caction\u003e?repo=\u003cfolder-name\u003e\u0026x-success=\u003curl\u003e\u0026x-error=\u003curl\u003e\n```\n\n| Action   | Description |\n|----------|-------------|\n| `pull`   | Fetch and fast-forward |\n| `push`   | Stage all, commit, and push |\n| `sync`   | Pull then push |\n| `status` | Return branch, SHA, and change count |\n\n## Building\n\n### Requirements\n\n- **Xcode 16+**\n- **iOS 17.0+** deployment target\n- macOS with Apple Silicon (or Intel with Rosetta)\n\n### Steps\n\n1. Clone the repo:\n   ```bash\n   git clone https://github.com/CodyBontecou/GitSync.md.git\n   cd GitSync.md\n   ```\n\n2. Open in Xcode:\n   ```bash\n   open Sync.md.xcodeproj\n   ```\n\n3. Select your target device or simulator and build (`⌘B`).\n\nThe pre-built `libgit2.xcframework` is included in the repo so no additional dependency setup is needed.\n\n## Testing\n\nRun the unit XCTest gate locally with:\n\n```bash\nxcodebuild test \\\n  -project Sync.md.xcodeproj \\\n  -scheme Sync.md \\\n  -destination 'platform=iOS Simulator,name=iPhone 17' \\\n  -only-testing:SyncMDTests \\\n  -parallel-testing-enabled NO\n```\n\nIf your machine does not have an `iPhone 17` simulator, replace the destination with any available iPhone simulator from `xcrun simctl list devices available`.\n\nThe local git tests create isolated temporary repositories via `FileManager.default.temporaryDirectory` and clean them up with `defer`. Fixture setup should use local-only commits (`commitLocalFixtureChanges` in `SyncMDTests`) unless the test is explicitly exercising push behavior; this avoids depending on expected push failures from repositories without an `origin` remote.\n\nThe same unit gate runs in GitHub Actions via `.github/workflows/xctest.yml` on pull requests and pushes to `main`.\n\n### OAuth Server (Optional)\n\nThe `oauth-server/` directory contains Vercel serverless functions that handle the GitHub OAuth flow. If you want to use OAuth sign-in (instead of a PAT), you'll need to:\n\n1. Create a [GitHub OAuth App](https://github.com/settings/developers)\n2. Deploy the oauth-server to Vercel\n3. Set `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` as environment variables\n4. Update the `serverURL` in `OAuthService.swift`\n\nUsing a **Personal Access Token** works without any server setup — just paste a token with `repo` scope.\n\n## Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests.\n\nSome areas where help would be appreciated:\n\n- Conflict resolution UI (currently only fast-forward merges)\n- Branch switching\n- Selective file staging\n- Background sync / scheduled pulls\n- macOS support\n\n### Editor Setup\n\nIf you use a SourceKit-LSP-based editor (Neovim, VS Code + Swift extension, Helix, Zed), generate a `buildServer.json` once so the LSP can resolve cross-file symbols:\n\n```bash\nbrew install xcode-build-server\nxcode-build-server config -project Sync.md.xcodeproj -scheme Sync.md\n```\n\nThe generated `buildServer.json` is gitignored. Build in Xcode once afterwards so the LSP picks up the compiler index.\n\n## License\n\n[MIT](LICENSE) — Cody Bontecou\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodybontecou%2Fgitsync.md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodybontecou%2Fgitsync.md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodybontecou%2Fgitsync.md/lists"}