What to Sync: Shared Rules, Device-Specific Settings

If you only need the same nodes on your computer and phone, import the same compatible subscription on both. To keep routing rules in sync too, maintain a shared source for those rules. Back up the client config separately when you need to restore a device. Updating nodes, publishing rules, and restoring a client are three different tasks; they don’t all need to live in one YAML file.

  • Good candidates for sharing: rule order, proxy group names, rule sets available on each device, and subscriptions whose provider permits use across devices. Proxy group names referenced by rules must match the names in the config.
  • Keep these settings local: listening ports, system proxy state, the TUN switch, DNS handling, and local file paths. For example, if your desktop’s system proxy points to 127.0.0.1:7890, that address refers to the desktop itself; it is not an address your phone can use to reach it. A phone routing traffic through its system VPN does not need to copy the desktop’s local proxy port either.
  • Verify these separately: manual proxy group selections, auto-update intervals, and last-updated times. Even with the same YAML loaded on both devices, manual selections may differ, or the node lists may look different because they were updated at different times.

First check which fields each client actually supports. A desktop client using mihomo does not mean a compatible mobile client can parse every mihomo field. If one client does not support an extension used by the other, share the rule logic and generate client-specific configs where needed.

Maintenance Costs of Four Sync Options

OptionWhat’s sharedDay-to-day workflowLimitations
Use the subscription link directlyContent published by the subscription providerImport once on each device, then refresh independentlyLocal edits to subscription content may be overwritten
Subscription with local overridesUse the subscription as a base and keep device-specific changesConfigure overrides on each device; review the merged result after subscription changesOverride options and merge syntax vary by client
WebDAV backupExported YAML or a client backup filePublish a snapshot, then download and import it on the target device when neededUploading a file doesn’t mean the client has activated the new config
Private Git repositoryRule source files, config templates, and change historyCommit changes, generate an importable file, then distribute it to each deviceA private repository is not necessarily a safe place for subscription tokens

Direct subscriptions and hosted configs: check what the URL returns

If every client can access the original subscription, import that URL directly and skip an extra publishing step. Follow the subscription import steps to add the remote config on each device, refresh it manually once, then activate it. Check the updated node names, proxy groups, and rules. A client showing “imported” does not mean it has switched to that config.

  • Check the subscription format: A full Clash config is different from a node-only list. The latter may not be importable as a complete YAML file. A login page or subscription preview page is not the config itself, so check the response content first if parsing fails.
  • Check refresh behavior: Manually refresh once on the receiving device before deciding whether to enable scheduled updates. Mobile background limits mean the configured refresh interval may not match when updates actually happen.
  • Check hosting access: Host a full YAML only if custom rules also need to be published at the same URL. Use HTTPS and an authentication method supported by the client, then test direct file access from the receiving device. Treat URLs containing tokens as credentials; don’t submit them to untrusted online conversion services.

Local Overrides: Keep Changes Without Editing a Subscription Copy

To preserve extra rules across subscription updates, use the client’s built-in override feature if it supports one. Put added rules in the override layer, then check the effective config after refreshing the subscription. If there’s no override option, generate a full config from a controlled template and import it; a locally imported file generally won’t update automatically when the original subscription changes.

Check That Rules Come Before the Fallback

This merged YAML snippet uses example domains to show direct-connection exceptions. It is not a universal override file and cannot replace a full config containing nodes and proxy groups. In practice, keep the existing rules and insert new ones before any broad rules that could match first and before the final fallback. The original config must define a proxy group named 默认代理 for this reference to work.

rules:
  - DOMAIN,intranet.example.com,DIRECT
  - MATCH,默认代理

Clash-family cores typically evaluate rules in order, and the first match determines where traffic goes. If a merge tool appends a new rule after MATCH, the exception won’t take effect. Replacing the entire rules list can also remove the subscription’s existing routing rules. After refreshing, inspect the loaded rule list, connect to a test domain you’re authorized to access, then check the matched rule and outbound policy in the logs or connection details. See rule fields for syntax.

WebDAV: Restore Configs from Versioned Snapshots

WebDAV works well for backups and manual migrations. Treat it as a remotely accessible folder; don’t assume the client watches for file changes, resolves conflicts, or reloads configs automatically. Even if a client supports WebDAV, check whether it syncs the entire app’s settings or a YAML file that can be used across clients.

  1. Export from the primary device. If you’re moving only the proxy config, export an importable YAML file if possible. If the only option is an app backup package, confirm the target device and client support that format. If the config references local rule files, include those files and update their paths for the target device.
  2. Keep the old version and upload a new one. For example, keep both clash-2026-11-10-r01.yaml and clash-2026-11-11-r01.yaml in the WebDAV folder. For another revision on the same day, use r02. Let one device publish updates to avoid the desktop and phone overwriting the same file.
  3. Import the file on the target device. For example, in macOS Finder, choose Go → Connect to Server… (⌘K) to access a supported WebDAV address. Download or copy the file locally, then import it using the client’s local-file option. If the mobile client can’t access WebDAV directly, save the file on the device with a compatible file manager, then open it in the client.
  4. Keep a rollback option. Import the new version as a separate config instead of overwriting the working one. After switching, verify the nodes and rules; if anything fails, switch back to the old version. Give download accounts read-only access where possible, and reserve write access for the publishing device.

Private Git: Track Rule Changes, Distribute Configs Separately

If you change rules often or need to know when a rule was edited, private Git makes reviewing differences easier than keeping dated files. Store templates and rule sources without credentials in the repository; keep node passwords, subscription URLs with tokens, and complete exported configs out of it. Phones don’t need Git: generate a device-ready file on the primary device, then deliver it through a controlled link or WebDAV.

Review the Files Being Staged Before Committing

For example, track only config.template.yaml and rules/common.yaml in the repository. Add the local output directory /out/ to the repository root’s .gitignore, then stage the source files explicitly instead of adding the entire working directory at once.

git add -- .gitignore config.template.yaml rules/common.yaml
git diff --cached --stat
git diff --cached
git commit -m "Update shared direct-connection rules"

.gitignore does not remove files that are already tracked or erase Git history. If you accidentally commit credentials, revoke or rotate them first, then clean up according to your repository’s procedures. To roll back, you can use git revert to undo a published rules commit, but you’ll still need to regenerate and distribute the current config. Rolling back the repository alone won’t roll back configs already imported on phones.

Configs Differ Across Devices? Check the Source, Active Config, and Traffic Path

  1. Check the source first. Make sure both devices are using the same source—one may be refreshing a remote subscription while the other still uses an older local YAML file. For remote configs, check the last successful update time; for local configs, check the revision in the filename.
  2. Then check what’s active. Confirm the new config is enabled and the proxy mode is Rule, not Global or Direct. Start a new connection to the same domain on both devices and compare the matched rule, proxy group, and actual outbound. Don’t use connections established before switching configs to judge the new setup.
  3. Finally, check the traffic path. On desktop, make sure the system proxy port matches the core’s listening port. If the system proxy is set to 127.0.0.1:7890, check that the core is actually accepting connections at that address and port. On phones, confirm the system VPN is connected. If traffic isn’t reaching the core, fix the system proxy or VPN state before checking rules and DNS.

If both devices only need the same node list, start by using the subscription directly. Add overrides only when you need to preserve device-specific differences across updates. WebDAV handles file delivery and recovery; Git handles rule review and version tracking. You can use both, but always confirm the new config is active on the receiving device.