Git Sync Setup Guide
Synchronize your Lokus workspace across unlimited devices for free using Git. This guide covers the complete setup process with the redesigned sync system introduced in v1.3.4.
What’s New in v1.3.4: The sync system was completely overhauled with a unified token system, simplified 3-field configuration, and better error handling. If you set up sync before v1.3.4, you may want to reconfigure using this guide.
Overview
The new sync system simplifies configuration from 6 fields down to 3 essential fields:
| Old System (v1.3.3) | New System (v1.3.4+) |
|---|---|
| Remote URL | ✅ Remote URL |
| Username | ✅ Username |
| Password (deprecated) | ❌ Removed |
| Personal Access Token | ❌ Merged into Token |
| GitHub Token | ❌ Merged into Token |
| ❌ Auto-generated | |
| Branch | ✅ Branch (optional, defaults to main) |
Key Improvements:
- Unified Token System: One token field instead of confusing dual-token setup
- Auto-generated Email: No need to manually enter email address
- Better Error Messages: Clear, actionable feedback on what went wrong
- Conflict Resolution UI: Visual tools for resolving merge conflicts
- Connection Testing: Verify credentials before saving
Prerequisites
Before setting up sync, you’ll need:
- A Git provider account (GitHub, GitLab, Bitbucket, etc.)
- A private repository to store your workspace
- A personal access token with repository access
- Internet connection for initial setup
Privacy First: Always use a private repository to keep your notes secure. Never use a public repository unless you intend to share your notes publicly.
Step 1: Create a Private Repository
GitHub Setup
- Go to github.com/new
- Enter a repository name (e.g.,
lokus-workspaceormy-notes) - Set visibility to Private ⚠️
- Do NOT initialize with README, .gitignore, or license
- Click Create repository
- Copy the repository URL from the page:
https://github.com/your-username/lokus-workspace.git
GitHub offers unlimited private repositories on free accounts. Perfect for personal note storage!
Step 2: Create a Personal Access Token
Git providers require a token for authentication. This is more secure than using your password.
GitHub Token
Navigate to Token Settings
- Go to github.com/settings/tokens
- Click Generate new token → Generate new token (classic)
Configure Token
- Note: Enter
Lokus Sync(helps you remember what this token is for) - Expiration: Choose duration:
- 90 days (Recommended for security)
- 1 year (Convenient but less secure)
- No expiration (Not recommended)
- Select scopes:
- ✅ Check
repo(Full control of private repositories) - ✅ This gives read/write access to your private repos
- ❌ Leave all other scopes unchecked
- ✅ Check
Save Token
- Click Generate token
- IMPORTANT: Copy the token immediately!
- You won’t be able to see it again
- Store it somewhere safe temporarily (you’ll paste it into Lokus)
- Example token format:
ghp_abcdef123456789...
Security Note: Treat this token like a password. Never share it, commit it to code, or post it publicly. If compromised, revoke it immediately in GitHub settings.
Token Expiration: When your token expires, you’ll need to generate a new one and update it in Lokus Settings → Sync. Lokus will show an authentication error when the token expires.
Step 3: Configure Lokus Sync
Now configure sync in your Lokus workspace with the simplified 3-field setup.
Open Sync Settings
- Open Lokus
- Press
Cmd+,(Mac) orCtrl+,(Windows/Linux) to open Settings - Click the Sync tab in the left sidebar
Enter Your Credentials
You’ll see three simple fields:
Field 1: Remote URL
- Paste your repository URL from Step 1
- Must end with
.git - Example:
https://github.com/yourusername/lokus-workspace.git
Field 2: Username
- Your Git provider username (not your email)
- GitHub: Your GitHub username
- GitLab: Your GitLab username
- Bitbucket: Your Bitbucket username
- Example:
johndoe
Field 3: Personal Access Token
- Paste the token you created in Step 2
- This is stored securely and encrypted locally
- Never exposed to external services
- Example:
ghp_abc123...(GitHub) orglpat-xyz...(GitLab)
Optional Field 4: Branch
- Usually auto-detected
- Default:
main - Most repositories use
mainormaster - Only change if your repository uses a different default branch
Auto-Save: Your sync settings are automatically saved as you type. Look for the “Saving…” indicator that appears briefly.
Initialize Git Repository
After entering credentials, expand the “Git Configuration” section at the bottom:
-
Click Initialize Git button
- Creates a local Git repository in your workspace
- Makes an initial commit of all existing files
- Shows ”✅ Git repository initialized” on success
-
Click Connect Remote Repository button
- Links your workspace to the remote repository
- Verifies your credentials
- Tests the connection
- Shows ”✅ Remote added successfully” on success
Troubleshooting Connection Errors:
If you see errors:
- ❌ “Invalid credentials”: Check username and token
- ❌ “Repository not found”: Verify repository URL ends with
.git - ❌ “Permission denied”: Ensure token has
reposcope (GitHub) orwrite_repository(GitLab) - ❌ “Network error”: Check internet connection
Verify Setup
Once both buttons show green checkmarks:
- ✅ Git repository initialized
- ✅ Remote added successfully
You’re ready to sync!
The sync status indicator (bottom-right corner) should change from gray to blue ☁️.
Step 4: First Sync
Perform your first sync to upload your workspace to the remote repository.
Option 1: Automatic Sync (Recommended)
- Make any change to a note (type something and save)
- The sync status indicator turns yellow ⚡ (changes pending)
- Click the status indicator
- Lokus commits and pushes your workspace automatically
Option 2: Manual Sync
- Right-click the sync status indicator (bottom-right)
- Select “Commit & Push” from the menu
- Your workspace is uploaded to the remote repository
First Sync Takes Longer: The initial sync uploads all files in your workspace. This may take 10-30 seconds depending on workspace size. Subsequent syncs are much faster (1-2 seconds) since only changes are uploaded.
Verify on Remote
Check your Git provider to confirm files were uploaded:
- Go to your repository on GitHub/GitLab/Bitbucket
- You should see all your workspace files
- Commit message: “Auto-sync workspace” or “Initial commit”
Step 5: Setup on Additional Devices
To sync the same workspace on another device:
Install Lokus
Install Lokus on your second device (Mac, Windows, or Linux).
Clone Workspace
Instead of creating a new workspace:
- Open Lokus
- Go to File → Clone Workspace from Git
- Enter the same credentials:
- Remote URL
- Username
- Personal Access Token
- Choose a local folder location
- Click Clone
Lokus downloads your workspace and sets up sync automatically.
Automatic Sync
From now on, both devices stay in sync:
- Changes on Device A → Push → Device B pulls updates
- Changes on Device B → Push → Device A pulls updates
Sync on Unlimited Devices: There’s no limit! Add as many devices as you need. All devices sync through your Git repository.
Understanding Sync Status
The sync indicator (bottom-right corner) shows the current status:
| Icon | Status | What It Means | Action |
|---|---|---|---|
| ☁️ Blue Cloud | Synced | Everything is up to date | None needed |
| 🔄 Spinning | Syncing | Pushing or pulling changes | Wait |
| ⚡ Yellow Branch | Changes Pending | You have uncommitted changes | Click to commit & push |
| ⚠️ Orange Warning | Conflicts | Merge conflicts need resolution | Right-click → See conflicts |
| ❌ Red X | Error | Sync failed | Check error message |
| ☁️ Gray Cloud | Not Configured | Sync not set up | Go to Settings → Sync |
Click Actions
- Left-click: Quick commit & push (if changes pending)
- Right-click: Open sync menu with more options:
- Pull Changes
- Commit & Push
- Check Status
- Force Push (dangerous!)
- Force Pull (dangerous!)
Conflict Resolution
When two devices modify the same file differently, conflicts occur.
Detecting Conflicts
Lokus shows conflicts with:
- ⚠️ Orange warning icon
- Status text: “2 conflicts”
- Notification: “Merge conflicts detected”
Viewing Conflicts
- Right-click the sync status indicator
- The menu shows conflicted files:
⚠️ 2 Conflicts Detected meeting-notes.md project-plan.md
Resolving Conflicts
Open Conflicted File
Open the file in Lokus editor. You’ll see conflict markers:
<<<<<<< Your Changes (Local)
# Meeting Notes - November 6th
=======
# Team Meeting - Nov 6
>>>>>>> Remote ChangesChoose Content
Manually edit the file to keep what you want:
- Keep local changes (above
=======) - Keep remote changes (below
=======) - Combine both (edit to merge content)
- Rewrite completely (start fresh)
Remove ALL conflict markers:
- Delete
<<<<<<< Your Changes (Local) - Delete
======= - Delete
>>>>>>> Remote Changes
Save and Commit
- Save the file
- Click sync status indicator
- Lokus commits your resolution
- Conflict resolved! ✅
Conflict Prevention
To minimize conflicts:
- Sync frequently: Pull changes before making major edits
- One device at a time: Avoid editing the same file on multiple devices simultaneously
- Communicate: If collaborating, coordinate who edits what
Force Resolution (Last Resort)
If conflicts are too complex, use force options:
Force Push (Keep Local):
- Overwrites remote with your local version
- ⚠️ Destroys remote changes permanently
- Use only if remote changes are unwanted
Force Pull (Keep Remote):
- Overwrites local with remote version
- ⚠️ Destroys your local changes permanently
- Use only if local changes are unwanted
DANGER: Force push/pull are destructive operations that cannot be undone. Only use them if you’re certain one version should be discarded completely.
Sync Menu Reference
Right-click the sync status indicator to access these options:
Pull Changes
- Downloads changes from remote repository
- Merges remote changes with your local workspace
- Safe: Won’t overwrite your uncommitted changes
- When to use: Another device pushed changes
Commit & Push
- Commits your local changes
- Pushes to remote repository
- Makes your changes available to other devices
- When to use: You made changes and want to sync them
Check Status
- Refreshes git status without syncing
- Shows if you’re ahead, behind, or have conflicts
- When to use: Curious about sync state without changing anything
Force Push
- ⚠️ Overwrites remote with local (DESTRUCTIVE)
- Discards all remote changes permanently
- When to use: Remote is corrupted and you want to replace it
Force Pull
- ⚠️ Overwrites local with remote (DESTRUCTIVE)
- Discards all local changes permanently
- When to use: Local is corrupted and you want to reset it
Advanced Configuration
Custom Branch
By default, Lokus uses the main branch. To use a different branch:
- Go to Settings → Sync
- Change the Branch field to your preferred branch (e.g.,
develop,notes) - Click Connect Remote Repository to verify
Multiple Workspaces
You can sync multiple workspaces to different repositories:
- Create separate repositories for each workspace
- Each workspace has its own sync configuration
- Switch between workspaces in Lokus (File → Open Workspace)
Sync with Self-Hosted Git
Lokus works with any Git server:
- Use your Git server’s HTTPS URL
- Generate access token in your Git server
- Configure Lokus sync with server URL and token
Examples:
- Gitea:
https://git.example.com/user/repo.git - Gogs:
https://gogs.example.com/user/repo.git - Azure DevOps:
https://dev.azure.com/org/project/_git/repo
Troubleshooting
”Authentication Failed”
Cause: Invalid username or token
Solution:
- Verify username is correct (not email)
- Generate a new token
- Ensure token has correct permissions:
- GitHub:
reposcope - GitLab:
write_repository+read_repository
- GitHub:
- Update token in Settings → Sync
”Repository Not Found”
Cause: Invalid repository URL or permission issue
Solution:
- Verify repository URL ends with
.git - Check repository is private (public repos can have different issues)
- Ensure token has access to the repository
- Try cloning the repository manually with Git to test credentials
”Network Error”
Cause: Connection issue
Solution:
- Check internet connection
- Try accessing Git provider website
- Verify firewall isn’t blocking Git connections
- Check if VPN is interfering
”Failed to Push - Non-Fast-Forward”
Cause: Remote has changes you don’t have locally
Solution:
- Right-click sync status
- Select Pull Changes first
- Resolve any conflicts
- Then Commit & Push
”Git Not Initialized”
Cause: Git repository not set up in workspace
Solution:
- Go to Settings → Sync
- Expand “Git Configuration”
- Click Initialize Git
- Then click Connect Remote Repository
Sync Indicator Stuck
Cause: Sync operation timed out or crashed
Solution:
- Restart Lokus
- Check sync status (right-click indicator → Check Status)
- If still stuck, go to Settings → Sync → Initialize Git again
Best Practices
1. Sync Frequently
Sync early and often to avoid conflicts:
- Before major editing sessions: Pull Changes
- After making changes: Commit & Push
- When switching devices: Pull Changes first
2. Use Descriptive Commits
When manually committing (via Git command line), use clear commit messages:
git commit -m "Add meeting notes from Q4 planning"3. Regular Token Rotation
For security, rotate your tokens every 90 days:
- Generate new token
- Update in Lokus Settings → Sync
- Revoke old token in Git provider
4. Backup Strategy
Sync is not a backup! Maintain separate backups:
- Export workspace periodically (File → Export Workspace)
- Use Time Machine (Mac) or File History (Windows)
- Keep critical notes in multiple locations
5. Private Repositories Only
Never sync sensitive notes to public repositories:
- Always use private repositories
- Double-check repository visibility settings
- Audit repository access regularly (who has access?)
6. Monitor Sync Health
Check the sync status indicator regularly:
- Blue ☁️ = Healthy
- Yellow ⚡ = Sync soon
- Orange ⚠️ = Take action
- Red ❌ = Fix immediately
Migrating from Old Sync System
If you set up sync before v1.3.4, follow these steps to migrate:
Backup Current Workspace
- File → Export Workspace
- Save backup to safe location
Note Current Settings
Write down your current:
- Remote URL
- Username
- Token (if you still have it)
Reconfigure Sync
- Go to Settings → Sync
- You’ll see the new simplified interface
- Enter the same credentials in the new fields:
- Remote URL (same)
- Username (same)
- Personal Access Token (use your existing GitHub/GitLab token)
Token Migration: The old system had separate “Password” and “Token” fields. The new system uses only the Personal Access Token in the unified “Token” field. If you were using password authentication, you MUST create a Personal Access Token (see Step 2 above).
Reinitialize Git
- Expand “Git Configuration”
- Click Initialize Git (may show already initialized - that’s OK)
- Click Connect Remote Repository
- Verify connection succeeds
Test Sync
- Make a small change to a note
- Click sync status indicator
- Verify push succeeds
- Check remote repository to confirm
Security & Privacy
How Tokens Are Stored
- Encrypted: Tokens are encrypted using OS-level encryption (Keychain on Mac, Credential Manager on Windows)
- Local Only: Tokens never leave your device
- No Cloud: Lokus doesn’t send tokens to any external service
- Secure Communication: All Git communication uses HTTPS
Data Privacy
- You Own Your Data: All notes stored in your private Git repository
- No Lokus Servers: Sync goes directly between your device and Git provider
- No Analytics: Lokus doesn’t track what you sync or when
- Open Source: Sync code is open source and auditable
Revoking Access
To revoke sync access:
- Revoke token in Git provider settings:
- GitHub: Settings → Developer settings → Personal access tokens → Revoke
- GitLab: Preferences → Access Tokens → Revoke
- Bitbucket: Settings → App passwords → Delete
- Remove from Lokus: Settings → Sync → Clear credentials
Audit Log
Your Git repository maintains a complete history:
- Every sync creates a commit
- View history:
git login workspace folder - See who changed what and when
- Revert to any previous state if needed
Frequently Asked Questions
Can I sync for free?
Yes! Git sync is completely free with:
- GitHub: Unlimited private repos, unlimited devices
- GitLab: 5GB free storage
- Bitbucket: 1GB free storage
How many devices can I sync?
Unlimited! There’s no device limit. Sync across as many devices as you need.
Does sync work offline?
Partially: You can work offline. Changes are queued locally and sync when you reconnect to the internet.
Can multiple people collaborate on one workspace?
Yes, but carefully:
- All users need repository access
- Set up sync with same repository
- Communicate to avoid conflicts
- Consider using branches for concurrent work
What’s the difference between sync and backup?
Sync: Real-time synchronization across devices. Data lives in Git repository.
Backup: Point-in-time snapshot stored separately. Use both!
Can I sync to Dropbox/Google Drive instead?
No direct integration, but you can:
- Create workspace folder in Dropbox/Google Drive
- Dropbox/Drive syncs the folder automatically
- Not recommended (can corrupt files if editing on multiple devices simultaneously)
- Git sync is safer and designed for this use case
What happens if my token expires?
Lokus shows an authentication error. Generate a new token and update it in Settings → Sync.
Can I use SSH instead of HTTPS?
Not yet. Current version supports HTTPS only. SSH support is planned for a future release.
Next Steps
Now that sync is set up:
- Conflict Resolution Tutorial - Learn to handle merge conflicts like a pro
- Advanced Sync Workflows - Branch strategies and team collaboration
- Git Sync Feature Page - Complete sync documentation
- Backup Strategies - Protect your data with multiple backups
Need Help?
- Check Troubleshooting section above
- Visit FAQ for common questions
- Join community Discord for support
- Email support: support@lokusmd.com