# Git File Sync
[](https://github.com/firstsun-dev/git-files-sync/actions/workflows/ci.yml)
[](https://github.com/firstsun-dev/git-files-sync/releases)
[](https://github.com/firstsun-dev/git-files-sync/releases)
[](https://obsidian.md)
[](https://www.typescriptlang.org/)
[](https://conventionalcommits.org)
[](LICENSE)
**Supports:**
**Git File Sync** is a powerful Obsidian plugin that enables seamless synchronization of individual notes with GitLab, GitHub, or self-hosted Gitea repositories. Unlike full-vault sync solutions, it gives you granular control over what gets pushed and pulled, making it perfect for shared projects, selective backups, and cross-platform workflows.
[繁體中文使用說明](USAGE_zh.md)
[git-file-sync](https://github.com/user-attachments/assets/78f383be-e8a4-4c9c-8845-1f46d06ea661)

*The Sync Status View provides a clear overview of your files, allowing you to selectively push, pull, or view diffs for modified files.*

*The Built-in Diff Viewer lets you compare local and remote changes side-by-side before syncing.*
---
## Supported Providers
| Provider | Hosting | Min. Version |
| :--- | :--- | :--- |
|
| github.com · GitHub Enterprise | — |
|
| gitlab.com · self-hosted | GitLab 13.0+ |
|
| self-hosted | Gitea 1.12+ |
> **Gitea compatibility note**: The plugin uses the Gitea API v1 (`/api/v1`). It resolves branch names to commit SHAs before fetching the file tree, which ensures compatibility with Gitea 1.12 and later. Versions before 1.12 are not supported.
---
## Key Features
### Selective Synchronization
Don't sync your whole vault. Selectively push or pull individual notes, or use batch operations for specific folders. Perfect for keeping personal notes private while sharing project files.
### Visual Sync Dashboard
A comprehensive dashboard provides a bird's-eye view of your vault's status:
- **Status Filtering**: Instantly see what's modified, new, or missing.
- **Visual Diffs**: Compare local and remote changes line-by-line before syncing.
- **Remote-Only Detection**: Identify files existing on GitLab/GitHub/Gitea that aren't in your vault yet.
### Intelligent Conflict Resolution
When versions clash, Git File Sync provides a dedicated diff viewer to help you resolve conflicts manually. Choose the local version, the remote version, or merge them with confidence.
### Mobile First
Full support for Obsidian Mobile. Push and pull your notes on the go with a responsive UI designed specifically for touch interfaces.
---
## Installation
### From Community Plugins (Recommended)
1. Open **Obsidian Settings** > **Community plugins**.
2. Click **Browse** and search for `Git File Sync`.
3. Click **Install**, then **Enable**.
### Manual Installation
1. Download the latest `main.js`, `manifest.json`, and `styles.css` from the [Releases](https://github.com/firstsun-dev/git-files-sync/releases) page.
2. Create a folder named `git-file-sync` in `/.obsidian/plugins/`.
3. Copy the downloaded files into that folder.
4. Reload Obsidian and enable the plugin.
---
## Configuration

*Configure the plugin by selecting your preferred Git service and providing the necessary credentials.*
### 1. Choose Your Service
Go to **Settings** > **Git File Sync** and select **GitLab**, **GitHub**, or **Gitea** from the dropdown.
### 2. Provider Setup
| | Provider | Required Info | Token Scope |
| :---: | :--- | :--- | :--- |
|
| **GitHub** | Personal Access Token, Owner, Repo Name | `repo` |
|
| **GitLab** | Personal Access Token, Project ID, Base URL | `api` |
|
| **Gitea** | Personal Access Token, Base URL, Owner, Repo Name | (all) |
**GitHub token**: Settings → Developer settings → Personal access tokens → `repo` scope.
**GitLab token**: User settings → Access tokens → `api` scope. The Base URL defaults to `https://gitlab.com`; change it for self-hosted instances.
**Gitea token**: User settings → Applications → Access tokens. Set the Base URL to your Gitea instance (e.g. `https://gitea.example.com`).
### 3. Common Settings
- **Branch**: Specify the target branch (default: `main`).
- **Root Path**: Prefix for files in the repository (e.g., `notes/`).
- **Vault Folder**: Limit sync to a specific folder in your vault.
- **Symbolic links**: Choose how symlinks are synced — *real* (recreate the link, GitHub only), *follow* (sync the target's content), or *skip*. See [Symbolic link handling](docs/symlink-handling.md).
---
## Usage Guide
### First-Time Setup
Once configured, you should perform an initial status check:
1. Open the **Sync Status View** by clicking the list icon in the left ribbon or using the Command Palette (`Open sync status view`).
2. Click **Refresh status**. The plugin will compare your local files with the remote repository.
3. Review the file list to see which files are synchronized, modified, or missing.
### Daily Workflow: Pushing Changes
When you finish editing a note and want to save it to Git:
- **Current Note**: Use the cloud icon in the ribbon or the command `Push current file to GitLab/GitHub/Gitea`.
- **Multiple Notes**: Open the Sync Status View, use the **Modified** filter, select the files you want to sync, and click **Push selected**.
- **Context Menu**: Right-click any file in the File Explorer and select `Push to GitLab/GitHub/Gitea`.
### Daily Workflow: Pulling Changes
To get the latest updates from other devices:
1. Open the Sync Status View and click **Refresh status**.
2. Files with remote updates will show as **Modified** or **Remote only**.
3. Select these files and click **Pull selected**.
4. **Warning**: Pulling will overwrite local changes. If there are conflicts, the Conflict Resolution tool will open.
### Handling Conflicts
If a file has changed both locally and on the remote server:
1. A **Conflict Resolution** window will appear.
2. The left pane shows your **Local** version, and the right pane shows the **Remote** version.
3. Review the differences.
4. Click **Keep Local** to overwrite the remote version on next push, or **Keep Remote** to accept the remote changes and overwrite your local file.
### Mobile Synchronization
On mobile devices:
- Swipe from the left to access the ribbon and open the Sync Status View.
- Use the **Pull** action to keep your mobile vault up to date before editing.
- After editing, use the **Push** action to save your changes back to the repository.
---
## Privacy and Security
- **Local Storage**: Your Personal Access Tokens (PAT) are stored locally in the plugin's data folder within your vault. They are never sent to any server other than your configured Git provider.
- **No Telemetry**: This plugin does not collect any data or usage analytics.
---
## Development
If you want to contribute or build from source:
```bash
# Clone and install
git clone https://github.com/firstsun-dev/git-files-sync.git
npm install
# Development build
npm run dev
# Production build
npm run build
```
---
## License
This project is licensed under the [MIT License](LICENSE).
---
**Created by [ClaudiaFang](https://github.com/ClaudiaFang)**