---
title: Git Sync
description: Clone a Git-backed workspace, configure a personal access token, and sync safely from iPhone
---

Git Sync keeps an on-device workspace in a remote Git repository. Octarine can clone the repository onto your iPhone, commit changes made on the phone, pull changes made elsewhere, rebase the phone's commits on top of them, and push the result.

Git Sync is available only for workspaces stored **On this iPhone**. iCloud and Dropbox workspaces use their own storage sync, so Settings doesn't show Git sync for them. To use Git, clone the repository into a new workspace instead.

> Git Sync is periodic, not real-time collaboration. Avoid editing the same note on two devices at exactly the same time. If both versions change the same lines, Octarine will ask how to resolve the conflict.

## Before You Begin

You need:

- A remote Git repository containing at least one supported Octarine file, such as a Markdown note. The iOS clone flow cannot import an empty repository.
- The repository's **HTTPS** URL, for example `https://github.com/you/notes.git`.
- For a private repository, your Git host username and a personal access token (PAT) with permission to read and write that repository.

Public repositories can be cloned without credentials, but pushing still requires write access.

## Create a GitHub Personal Access Token

GitHub passwords cannot be used for Git operations over HTTPS. Use a fine-grained personal access token instead.

1. Open [GitHub's fine-grained token settings](https://github.com/settings/personal-access-tokens/new). If needed, sign in to GitHub first.
2. Enter a descriptive **Token name**, such as `Octarine iPhone`.
3. Choose an **Expiration**. When the token expires, Git Sync will stop authenticating until you replace it in Octarine.
4. Under **Resource owner**, choose the user or organization that owns the notes repository.
5. Under **Repository access**, choose **Only select repositories**, then select only your notes repository.
6. Under **Repository permissions**, set **Contents** to **Read and write**. GitHub automatically includes the metadata access it requires.
7. Leave unrelated permissions set to **No access**, then tap **Generate token**.
8. Copy the token immediately and store it somewhere safe. GitHub will not show the full value again.

GitHub organization repositories may require an administrator to approve the token. A token waiting for approval can read public resources only, so cloning or pushing a private organization repository may fail until it is approved. See [GitHub's PAT documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) for organization policies, expiry, revocation, and classic-token instructions.

If you use a classic GitHub token instead, it needs the `repo` scope for a private repository. Fine-grained tokens are safer because they can be limited to one repository.

### GitLab Tokens

For GitLab, create a personal, project, or group access token with `write_repository`, which includes Git-over-HTTPS read and write access. See [GitLab's access-token scopes](https://docs.gitlab.com/security/tokens/access_token_scopes/). Enter your GitLab username and use the token in Octarine's **Token** field.

## Clone the Repository as a Workspace

Git-backed workspaces are created by cloning the remote repository:

1. Open **More**, tap the current workspace name, then choose **Manage Workspaces**.
2. Tap **Create new workspace**.
3. Select **Clone from Git**.
4. Paste the repository's HTTPS URL into **Repository URL**.
5. For a private repository, enter your Git host **Username** and the PAT in **Token for private repos**. Leave both fields empty for a public repository that does not require authentication.
6. Optionally choose the workspace color. The workspace name is taken from the repository name.
7. Tap **Clone repository** and keep Octarine open while it downloads, checks out, and imports the files.

The clone is stored locally at **On My iPhone → Octarine → _repository-name_**. Git workspaces cannot be cloned into iCloud or Dropbox.

Octarine imports supported notes, folders, daily and weekly notes, templates, Inbox captures, attachments, and files from the clone. It then opens the workspace, enables Auto Sync, and sets the initial interval to 10 minutes.

If a folder with the repository name already exists in Octarine, choose a different repository name or remove the existing folder before trying again.

## Credentials and Security

The token is saved for this workspace in Octarine's encrypted on-device credential vault, protected by the Apple Keychain. It is not written into the repository URL or into a note.

To change it later, open **Settings → Git sync** and find **Access token** under **Access**:

- **Replace token** lets you enter a new username and token, which is useful after rotation or expiry.
- **Remove** deletes the saved credentials for this workspace. Public fetches may continue to work, but private fetches and authenticated pushes will fail until credentials are added again.

Treat a PAT like a password. Do not paste it into a note, commit it to the repository, or send it in a support request. If it is exposed, revoke it at your Git host and create a replacement.

## Syncing

Open **Settings → Git sync**. A status card at the top shows the repository, whether it is **Synced**, **Syncing…**, **Not synced yet**, or **Sync paused**, and when it last synced. It also tells you when sync failed or when this iPhone and the remote both have new changes. **Pull** and **Sync Now** sit on the card.

Below it are **Auto Sync** and its interval, **When notes conflict**, **Include in sync**, and your **Access token**.

If the current workspace isn't a Git repository, the page explains what you'll need and offers **Clone into a new workspace**.

### Pull Changes

Tap **Pull Changes** to fetch and apply remote changes without committing or uploading local edits. It is also available in the Command Bar.

If both the phone and remote have diverged, Octarine asks you to use **Sync Now**, which can commit the local work and integrate both sides. When a conflict happens during Pull, resolving it completes the pull but does not upload the result; run Sync Now when you are ready to push.

### Sync Now

Tap **Sync Now** on the Git Sync page. You can also pull down to open the Command Bar and run **Sync Now** under Git Sync.

For each sync, Octarine:

1. Creates a local commit for all changed, non-ignored files with the message `Updated from Octarine iOS`.
2. Fetches the current branch from `origin`.
3. Fast-forwards when only the remote has changed, or rebases the phone's commits on top of the remote branch when both sides have changed.
4. Pushes the current branch back to `origin` when the phone is ahead.

If the phone is offline, Octarine can still create the local commit. The pull and push wait until a later sync after connectivity returns.

### Auto Sync

Turn on **Auto Sync**, then choose an interval of 5, 10, 15, 30, or 60 minutes.

Auto Sync applies only to the current workspace. Keep Octarine open while a large clone, sync, or conflict resolution is in progress.

## Folder Sync

Octarine respects the repository's `.gitignore`. Under **Settings → Git sync → Include in sync**, choose whether these workspace folders should sync:

- **Templates** (`/.templates`)
- **Files** (`/.files`)
- **Attachments** (`/.attachments`)

Choosing **Sync** removes Octarine's ignore rule for that folder; choosing **Don't sync** adds it. Markdown notes, Daily notes, and Inbox files remain part of the repository unless another `.gitignore` rule excludes them.

Files already tracked by Git may remain tracked after a new ignore rule is added. Other custom `.gitignore` entries are preserved.

## Resolving Conflicts

Octarine first tries to integrate iPhone and remote work automatically. When the same note was changed in both places and the changes can't be combined, an **Edited in two places** sheet opens. Both versions are safe until you choose.

For each note, the sheet shows what changed on **This iPhone** and on the **Remote**, such as "Added 3 lines, removed 1" and when it happened. Choose which version to keep:

| Choice | Result |
| --- | --- |
| **This iPhone** | Keeps the iPhone's version. The remote edits are replaced. |
| **Remote** | Keeps the remote version. Your iPhone edits are replaced. |
| **Both** | The remote version stays on top and your iPhone edits are added below it, so you can tidy up later. For files that aren't text, the remote file is kept and the iPhone's copy is saved next to it with a `.mobile-conflict` suffix. |

If a note was deleted on one side and edited on the other, the choices are **Keep note** or **Delete it**.

With several notes in conflict, you can apply one choice to all of them, or tap **Review one by one** to decide per note. **Compare versions** shows the two versions as a line diff, with removed lines in red and added lines in green. Tap **Decide later** to close the sheet and come back to it from **Settings → Git sync** or the Command Bar.

After you choose, Octarine finishes the sync. If the conflict came from **Pull Changes**, nothing is uploaded until you run **Sync Now**.

**Both** preserves everything for manual cleanup, but the combined text may contain duplicated paragraphs or invalid frontmatter. Open the affected notes after the sync, reconcile them, and sync again.

### Resolve Conflicts Automatically

Under **Settings → Git sync**, **When notes conflict** decides what happens without asking:

- **Ask me** (the default) opens the conflict sheet.
- **Keep this iPhone's** replaces the remote edits.
- **Keep the remote's** replaces your iPhone edits.
- **Keep both** puts the remote version first and your iPhone edits below it.

Octarine still tells you which notes changed.

## Troubleshooting

### Authentication failed

- Confirm that the repository URL begins with `https://` and points to the correct repository.
- Use your Git host username, not your email address, unless your host explicitly requires otherwise.
- Check that the token has not expired or been revoked.
- For GitHub, confirm that the token's resource owner and selected repository are correct, **Contents** is **Read and write**, and any organization approval has completed.
- In **Settings → Git sync**, choose **Replace token**, save the new token, and try **Sync Now** again.

### Clone finishes downloading but nothing is imported

The repository must contain a supported note, folder, attachment, or file. Add and push at least one Markdown note from another Git client, then clone again.

### Push is rejected

Confirm that the account behind the token has write access and that branch protection allows direct pushes to the checked-out branch. Octarine pushes the repository's current branch directly; it does not create pull requests.

### The remote changed while the phone had edits

Run **Sync Now**. Octarine rebases the phone's commits on top of the fetched branch. If the changes overlap, use the conflict controls described above.

### I no longer want Git Sync

Remove the saved access token, then tap **Reset Git Sync settings**. It turns off Auto Sync and puts the settings back to their defaults. Your notes and the repository's `.git` history stay as they are.

#### Quick Answers

### Can I use Git Sync with an iCloud or Dropbox workspace?

No. Git Sync is available only for workspaces stored locally on the iPhone.

### Which GitHub token permission does Octarine need?

Use a fine-grained token limited to the notes repository with **Contents: Read and write**.

### What does Octarine do when mobile and remote notes conflict?

It shows both versions of each note and lets you keep this iPhone's, the remote's, or both. You can also set **When notes conflict** to resolve them automatically.
