📱
iPhone(iPad)でGitHubのObsidian Vaultを同期する
TL;DR
Obsidian Git プラグインはモバイルでは不安定。代わりに Working Copy を使えば iPhone だけで安全に Pull/Commit/Push までこなせます。本記事では Vault 作成 → GitHub クローン → フォルダリンク → 自動化 まで徹底解説します。
なぜ Obsidian Git を使わないのか?
結論:モバイルはネイティブ Git クライアントの Working Copy に任せるのが現状ベストプラクティス。
- プラグイン作者は モバイルの libgit2 が大量ファイルを扱えない ことを認め、根本対応が難しいとコメントしています ([Bug]: iOS crash on clone with 4.5k files · Issue #475 · Vinzent03/obsidian-git · GitHub)。
- iOS 17/16 ともに報告があり、ファイル数 3–5 千、容量 200 MB 超あたりで顕在化するケースが多いです ([Bug]: iOS crash on clone with 4.5k files · Issue #475 · Vinzent03/obsidian-git · GitHub, [Bug]: Obsidian closes during initial clone · Issue #694 · Vinzent03/obsidian-git · GitHub)。
- Push 側のクラッシュは “timeout → プラグイン再起動” パターンで、libgit2 のメモリ不足が疑われています ([Bug]: Pushing broken on iphone obsidian git · Issue #609 · Vinzent03/obsidian-git · GitHub)。
必要なもの
役割 | アプリ / サービス | メモ |
---|---|---|
Git クライアント | Working Copy (v5.4+) | Push は Pro アドオンが必要 |
ノート | Obsidian (iOS) | 著者はiPhoneユーザーなのでiOS版 |
Vaultホスティング | GitHub | PAT または SSH認証でPull, Push |
自動化 | ショートカット | Pull/Push の自動実行用 |
Step 1 – Vault をローカルに用意
- Obsidian → Create new vault。
- 「iCloud に保存」を オフ にして
On My iPhone/Obsidian/<VaultName>
に作成。
Step 2 – GitHub リポジトリを Working Copy にクローン
- Working Copy 起動 → 右上Working Copyマークの
+
→ Clone repository。 - URL を入力 (
https://github.com/<user>/<repo>.git
)。認証は PAT が簡単。 - クローン完了後、リポジトリヘッダ右の
⌄
をタップ → Link Repository to Directory を選択。機能名が旧 Setup sync folder から変更されています。(追記:iPad版のWorkingCopyでは、Setup Sync forという選択肢があるので、そちら)(さらに追記:iphone版でもSetup Sync forなりました) - ファイルアプリが開くので
On My iPhone › Obsidian › <VaultName>
を指定 → Link。 - これで ローカルVaultのディレクトリにGitHubのリモートVaultが双方向ミラーされます。
- Pro アドオン未購入だとリンク時に課金ダイアログが出ます。
Step 3 – 手動で Push してみる
- Obsidian でノートを編集 → 保存。
- Working Copy を開き modified files を確認して全てstage。
-
Commit → メッセージ入力(例:
iphone notes update
)→ Commit。 -
Push をタップ。これで GitHub の
main
に反映されます。 - GitHub ウェブで確認し、変更があるかをチェック。
Step 4 – ショートカットで “開いたら Pull / 閉じたら Push” 自動化
4‑1 ショートカットを作成
-
Pull Vault
- Action: Working Copy → Pull Repository
- Repo:
<VaultRepo>
/ Remote:origin/main
-
Commit & Push Vault
- Actions: Commit Repository → Push Repository
- Commit message:
"🤖 iOS auto‑update – [[Current Date]]"
- commit repositoryブロックの、What to Commitをmodifiedに設定
4‑2 オートメーション設定
- ショートカット → Automation → Create Personal Automation。
- Trigger App → Obsidian → Opens → Action Run Shortcut: Pull Vault。
- 同様に App → Obsidian → Closes → Action Run Shortcut: Commit & Push Vault。
- “Ask Before Running” を オフ。
トラブルシューティング
症状 | 原因 | 解決策 |
---|---|---|
Link Repository to Folder が無い | Working Copy 古い | App Store で v5.4+ に更新 |
Push で “needs authentication” | PAT 期限切れ | GitHub で再発行し設定 |
Pull が “detached HEAD” になる | Obsidian Git との競合 | モバイルではプラグインを無効化、 .obsidian/plugins/obsidian-git/を.gitignoreに追記してもいいかも |
Obsidian が初回 Clone で落ちる | モバイル libgit2 制限 | 手順通り Working Copy で Clone |
まとめ
- 理由:Obsidian Git プラグインは iOS で不安定。Working Copy に置き換えると安全。
- 流れ:Vault 作成 → Repo Clone → Folder Link → Commit/Push テスト → Shortcuts で自動化。
- これで ラボ・講義・研究メモも即 GitHub バックアップ。ノートのバージョン管理が捗ります!
Discussion