Git Sync - Free Cross-Device Synchronization
Lokus Git Sync enables you to synchronize your workspace across unlimited devices completely free using Git providers like GitHub, GitLab, or Bitbucket. Your notes stay private, secure, and under your control.
Overview
Git Sync provides:
- 100% Free: No subscription fees, unlimited devices and storage (within Git provider limits)
- Universal Compatibility: Works with GitHub, GitLab, Bitbucket, and any Git remote
- Automatic Syncing: Changes commit and sync automatically
- Conflict Resolution: Intelligent merge strategies with manual override options
- Privacy First: Your data stays encrypted in transit, you control access
- Version History: Full Git history for every change
- Offline Support: Work offline, sync when connected
- Multi-Platform: Sync between Windows, macOS, and Linux
How Git Sync Works
The Basics
Git Sync uses Git version control to synchronize your workspace:
- Local Changes: As you edit notes, Lokus tracks changes
- Auto-Commit: Changes are automatically committed to your local Git repository
- Push: Commits are pushed to your remote repository (GitHub, GitLab, etc.)
- Pull: Other devices pull changes from the remote to stay in sync
- Merge: If changes conflict, Lokus helps resolve them
Sync Status Indicator
The sync status indicator appears in the bottom-right of your workspace:
| Icon | Status | Meaning |
|---|---|---|
| ☁️ Cloud (Blue) | Synced | All changes are synchronized |
| 🔄 Spinning | Syncing | Currently pushing or pulling changes |
| ⚡ Branch (Yellow) | Changes Pending | You have uncommitted local changes |
| ⚠️ Warning (Orange) | Conflicts | Merge conflicts need resolution |
| ❌ Error (Red) | Error | Sync failed, check error message |
| ☁️ Cloud (Gray) | Not Configured | Git sync not set up yet |
Click the status to commit and push changes. Right-click the status to open the sync menu with more options.
Initial Setup
Create a Private Repository
First, create a private Git repository to store your notes.
GitHub:
- Go to github.com/new
- Enter a repository name (e.g.,
lokus-notes) - Set visibility to Private (important for privacy!)
- Don’t initialize with README, .gitignore, or license
- Click Create repository
- Copy the repository URL (e.g.,
https://github.com/yourusername/lokus-notes.git)
GitLab:
- Go to gitlab.com/projects/new
- Enter a project name
- Set visibility to Private
- Create project
- Copy the repository URL
Bitbucket:
- Go to bitbucket.org/repo/create
- Enter a repository name
- Set to Private
- Create repository
- Copy the clone URL (HTTPS)
Always use a private repository to keep your notes secure. Never use a public repository unless you intend to share your notes publicly.
Create a Personal Access Token
Git providers require a token for authentication instead of your password.
GitHub (Recommended):
- Go to github.com/settings/tokens
- Click Generate new token → Generate new token (classic)
- Name:
Lokus Sync - Expiration: Choose duration (90 days or custom)
- Select scopes:
- ✅
repo(Full control of private repositories)
- ✅
- Click Generate token
- Copy the token immediately (you won’t see it again!)
- Store it securely (you’ll need it for setup)
GitLab:
- Go to gitlab.com/-/profile/personal_access_tokens
- Token name:
Lokus Sync - Expiration: Set date
- Scopes:
write_repository,read_repository - Create token and copy it
Bitbucket:
- Go to Settings → Personal Settings → App passwords
- Create app password
- Label:
Lokus Sync - Permissions:
Repositories: Read,Repositories: Write - Create and copy the password
Token Security: Treat tokens like passwords. Never share them or commit them to code. If a token is compromised, revoke it immediately in your Git provider settings.
Configure Git Sync in Lokus
Now configure sync in your Lokus workspace.
- Open your workspace in Lokus
- Go to Settings → Sync (Cmd+, then Sync tab)
- You’ll see the setup screen
Fill in the configuration:
-
Remote URL: Paste your repository URL
- Example:
https://github.com/yourusername/lokus-notes.git - Must end with
.git
- Example:
-
Username: Your Git provider username
- GitHub: Your GitHub username (not email)
- GitLab: Your GitLab username
- Bitbucket: Your Bitbucket username
-
Personal Access Token: Paste the token you created
- This is stored securely and encrypted locally
- Never exposed to external services
-
Branch: The branch to sync (default:
main)- Most repositories use
mainormaster - Lokus auto-detects this if Git is already initialized
- Most repositories use
Auto-Save: Your sync settings are automatically saved as you type. You’ll see a “Saving…” indicator briefly appear.
Initialize Git and Connect Remote
After entering your credentials, initialize Git in your workspace.
Expand “Git Configuration” section and click:
-
Initialize Git button
- Creates a local Git repository in your workspace
- Makes an initial commit
- Shows ”✅ Git repository initialized”
-
Connect Remote Repository button
- Links your workspace to the remote repository
- Verifies credentials
- Shows ”✅ Remote added successfully”
If you see any errors, check:
- Repository URL is correct and ends with
.git - Token has correct permissions
- Internet connection is working
Success! You’re now ready to sync. The status indicator should show a blue cloud ☁️.
First Sync
Perform your first sync to upload your workspace.
Option 1: Automatic (Recommended)
- Make a change to any note
- The status indicator turns yellow (changes pending)
- Click the status indicator
- Lokus commits and pushes your workspace
Option 2: Manual
- Right-click the sync status indicator
- Select Commit & Push
- Your workspace is uploaded to the remote
On your first push, you may see a progress indicator for a few seconds as all files upload.
Setting Up Additional Devices
Install Lokus on Second Device
Download and install Lokus on your other device(s) from lokus.app.
Create Empty Workspace Folder
On the new device:
- Create an empty folder where you want your notes
- Example:
Documents/Lokus-Sync/or~/Notes/ - Don’t add any files to this folder
Open Workspace and Configure Sync
- Open Lokus and select the empty folder as your workspace
- Go to Settings → Sync
- Enter the same credentials as your first device:
- Remote URL (same repository)
- Username (same username)
- Token (generate a new token or reuse existing)
- Branch (same branch, usually
main)
Initialize Git
- Click Initialize Git (creates local repository)
- Click Connect Remote (links to your repository)
Pull Your Notes
- Right-click the sync status indicator
- Select Pull Changes
- Lokus downloads all your notes from the remote
- Wait for sync to complete
Done! Your second device now has a complete copy of your workspace and will stay in sync automatically.
Daily Usage
Automatic Syncing
Lokus handles most syncing automatically:
When you make changes:
- Edit your notes normally
- Status indicator shows “Changes pending” (yellow)
- Click the indicator or wait for auto-sync (if enabled)
- Changes commit and push automatically
When pulling changes:
- Lokus periodically checks for remote changes
- Or: Right-click status → Pull Changes
- New changes merge automatically
- You see updated content instantly
Manual Sync Operations
Commit & Push (Upload your changes)
Right-click status → Commit & Push
Or: Click status when changes are pendingPull (Download remote changes)
Right-click status → Pull Changes
Shortcut: Cmd+Shift+P (Windows: Ctrl+Shift+P)Check Status (View sync state)
Right-click status → Check Status
Shows: Changes, ahead/behind counts, conflictsSync Status Details
Right-click the status indicator and expand the status section to see:
- Status: Current sync health (Healthy, Pending, Conflicts, Error)
- Last synced: Time since last successful sync
- Branch: Active Git branch
- Changes: Whether you have uncommitted changes
- Ahead: Commits not yet pushed to remote
- Behind: Commits on remote not yet pulled
Conflict Resolution
What Are Conflicts?
Conflicts occur when the same file is modified on multiple devices in incompatible ways.
Example:
- Device A: Changes line 5 of
note.mdto “Version A” - Device B: Changes line 5 of
note.mdto “Version B” - Device B pushes first
- Device A tries to push → Conflict!
Automatic Conflict Resolution
Lokus automatically resolves technical file conflicts:
Auto-Resolved (Keep Local):
.lokus/folder (app configuration).DS_Store(macOS metadata).vscode/,.idea/(editor settings)
Auto-Resolved (Keep Remote):
package-lock.json,yarn.lock(lock files)
These conflicts never require manual intervention.
Manual Conflict Resolution
When your note content conflicts, Lokus helps you resolve it.
Conflict Indicators:
- ⚠️ Orange warning icon in status
- Conflict counter shows number of files
- Right-click status to see affected files
Resolution Process:
Identify Conflicted Files
Right-click the sync status indicator. The conflict section shows:
- Number of conflicts
- List of conflicted file paths
- Visual explanation of conflict markers
Open Conflicted Files
Lokus adds conflict markers to show both versions:
<<<<<<< Your Changes (Local)
This is your local version of the text.
You wrote this on your current device.
=======
This is the remote version of the text.
Someone else (or you on another device) wrote this.
>>>>>>> RemoteUnderstanding markers:
<<<<<<< Your Changes: Start of your local changes=======: Separator between versions>>>>>>> Remote: End of remote changes
Edit to Keep Desired Content
Open the file in Lokus editor and manually resolve:
Option 1: Keep Your Changes
This is your local version of the text.
You wrote this on your current device.(Delete conflict markers and remote content)
Option 2: Keep Remote Changes
This is the remote version of the text.
Someone else (or you on another device) wrote this.(Delete conflict markers and your local content)
Option 3: Merge Both
This is your local version of the text.
You wrote this on your current device.
This is the remote version of the text.
Someone else (or you on another device) wrote this.(Keep both versions, remove markers)
Option 4: Write New Content
This is a completely new version that combines
the best ideas from both versions.(Replace everything with new content)
Important: You must remove ALL conflict markers (<<<<<<<, =======, >>>>>>>) or the file won’t render correctly.
Save and Commit
- Save the file (Cmd+S / Ctrl+S)
- Click the sync status indicator
- Select Commit & Push
- Your resolved changes push to remote
- Conflict resolved! ✅
Force Resolution (Advanced)
For situations where you want to discard all changes on one side:
Force Push (Keep Local, Discard Remote)
Right-click status → Advanced → Keep My Local Changes
⚠️ Warning: Overwrites ALL remote changesUse when:
- You know remote changes are outdated
- You want to reset remote to match your device
- You’re certain local version is correct
Force Pull (Keep Remote, Discard Local)
Right-click status → Advanced → Use Remote Changes
⚠️ Warning: Discards ALL local changesUse when:
- Your local changes are mistakes
- You want to reset to remote version
- Another device has the correct version
Destructive Operations: Force push/pull cannot be undone easily. Always make sure you have backups before using these options.
Authentication & Security
How Tokens Are Stored
Lokus stores your Git credentials securely:
Storage Location:
- macOS: System Keychain
- Windows: Windows Credential Manager
- Linux: System keyring (libsecret)
Encryption:
- Tokens encrypted at rest
- Only accessible to Lokus app
- Never sent to third parties
- Only used for Git operations
Token Expiration
Personal access tokens expire based on your settings:
When a token expires:
- Sync status shows “Auth failed” (orange login icon)
- Hover to see: “Your session has expired or authentication failed”
- Click status or right-click → Re-authenticate
Renewing token:
- Go to your Git provider’s token settings
- Regenerate or create new token (same scopes)
- Go to Lokus Settings → Sync
- Paste the new token
- Sync resumes automatically
Best Practice: Set token expiration to 90 days or more to avoid frequent renewal. Shorter expiration is more secure but requires more maintenance.
Token Permissions
Tokens must have these permissions:
GitHub:
repo(Full control of private repositories)- Includes:
repo:status,repo_deployment,public_repo,repo:invite
- Includes:
GitLab:
write_repository(Read and write to repository)read_repository(Read repository data)
Bitbucket:
Repositories: ReadRepositories: Write
Minimal permissions are recommended for security.
Repository Privacy
Always use private repositories for your notes:
- ✅ Private: Only you (and collaborators) can access
- ❌ Public: Anyone on the internet can read your notes
To check repository privacy:
- GitHub: Go to repository → Settings → Danger Zone → Change visibility
- GitLab: Go to project → Settings → General → Visibility
- Bitbucket: Go to repository → Settings → Repository details → Access level
Two-Factor Authentication (2FA)
If your Git provider has 2FA enabled:
GitHub:
- Personal access tokens work with 2FA
- No additional setup needed
- Token bypasses 2FA for Git operations
GitLab:
- Personal access tokens work with 2FA
- No code required for sync
Bitbucket:
- Use App Passwords (not regular password)
- App passwords work with 2FA
Recommended: Enable 2FA on your Git provider account for maximum security. Lokus sync works seamlessly with 2FA using tokens.
Branch Management
Understanding Branches
Branches let you organize different versions of your workspace.
Common use cases:
main- Your primary workspacework- Work-related notespersonal- Personal notesarchive- Old notes
Default Branch
Most repositories use main as the default branch:
- Modern repositories:
main - Older repositories:
master
Lokus auto-detects your default branch during setup.
Switching Branches
To sync with a different branch:
- Go to Settings → Sync
- Expand Git Configuration
- Change Branch field to branch name
- Click Connect Remote again
- Right-click status → Pull Changes
Your workspace updates to the new branch’s content.
Creating New Branches
You can create branches using Git commands:
# In your workspace folder
cd /path/to/workspace
git checkout -b new-branch
git push -u origin new-branchThen switch to the branch in Lokus settings.
Most users don’t need branches. The default main branch works great for single-user synchronization across devices.
Platform-Specific Setup
macOS
Requirements:
- macOS 11 (Big Sur) or later
- Git pre-installed (comes with Xcode Command Line Tools)
Verify Git:
git --version
# Should show: git version 2.x.xToken Storage:
- Stored in macOS Keychain
- Encrypted by system
- Access controlled by macOS permissions
Workspace Location:
- Recommended:
~/Documents/Lokus/ - iCloud Drive:
~/Library/Mobile Documents/com~apple~CloudDocs/Lokus/- Note: Combining Git sync with iCloud can cause conflicts
Windows
Requirements:
- Windows 10 or Windows 11
- Git for Windows installed
Install Git:
- Download from git-scm.com
- Run installer
- Use default settings
- Restart Lokus after installation
Verify Git:
git --versionToken Storage:
- Stored in Windows Credential Manager
- Encrypted by system
- View: Control Panel → Credential Manager → Windows Credentials
Workspace Location:
- Recommended:
C:\Users\YourName\Documents\Lokus\ - OneDrive: Works but may cause conflicts with Git sync
Windows Defender: May scan files during sync operations, slightly slowing performance. This is normal and safe.
Linux
Requirements:
- Git installed
- libsecret (for secure token storage)
Install Git:
# Ubuntu/Debian
sudo apt install git libsecret-1-0
# Fedora
sudo dnf install git libsecret
# Arch
sudo pacman -S git libsecretVerify Git:
git --versionToken Storage:
- Stored in system keyring (GNOME Keyring, KWallet, etc.)
- Requires
libsecret
Workspace Location:
- Recommended:
~/Documents/Lokus/or~/Notes/ - Avoid: Mounted network drives (poor Git performance)
Best Practices for Multi-Device Usage
Work-Edit-Sync Pattern
Follow this pattern for seamless multi-device workflows:
On each device:
- Pull first: Always pull before editing
- Edit: Make your changes
- Push: Commit and push when done
Example:
Morning (Laptop):
1. Open Lokus
2. Right-click status → Pull Changes
3. Make edits throughout the day
4. Before closing → Click status to push
Afternoon (Phone - hypothetical):
1. Open Lokus
2. Pull changes (sees morning edits)
3. Add quick notes
4. Push changes
Evening (Desktop):
1. Open Lokus
2. Pull changes (sees phone notes)
3. Continue editing
4. Push when doneMinimize Conflicts
Tips to avoid conflicts:
- Pull frequently: Pull before each work session
- Push often: Push after finishing editing
- One device at a time: Don’t edit same note simultaneously
- Designate primary device: Do major edits on one device
- Use separate notes: Create device-specific notes if needed
File Organization
Sync-friendly structure:
workspace/
├── Daily/ # Daily notes (rarely conflict)
├── Projects/ # Project notes
│ ├── Project-A/ # Separate folders reduce conflicts
│ └── Project-B/
├── Reference/ # Read-only references (never conflict)
└── _Archive/ # Old notesHandling Long Offline Periods
If you work offline for extended periods:
Before going offline:
- Pull latest changes
- Work normally offline
- All changes saved locally
When back online:
- Pull first (may show conflicts if others pushed)
- Resolve any conflicts
- Push your changes
Git stores full history locally, so you never lose work even when offline for days or weeks.
Performance Optimization
Keep sync fast:
-
Avoid large files: Git performs poorly with files >50MB
- Store images elsewhere (cloud storage, local folder)
- Link to them instead of embedding
-
Use .gitignore: Exclude non-essential files
# .gitignore in workspace root .DS_Store .lokus/cache/ *.tmp -
Limit binary files: Markdown, plain text sync best
- PDFs, images, videos slow down sync
- Consider external storage for media
-
Regular commits: Small, frequent commits sync faster than large batches
Troubleshooting
Common Issues
”Authentication Failed” Error
Symptoms:
- Orange login icon in status
- Error: “Your session has expired or authentication failed”
Solutions:
-
Check token expiration:
- Go to Git provider → Token settings
- Check if token expired
- Generate new token if needed
-
Verify token permissions:
- GitHub: Must have
reposcope - Check token has write access
- GitHub: Must have
-
Re-enter credentials:
- Settings → Sync
- Re-enter username and token
- Try syncing again
”Network Connection Failed” Error
Symptoms:
- Red error icon
- Error: “Network connection failed”
Solutions:
-
Check internet connection:
- Test browsing a website
- Try:
ping github.com
-
Check repository URL:
- Must be HTTPS (not SSH)
- Format:
https://github.com/user/repo.git
-
Firewall/VPN:
- Check if firewall blocks Git
- Try disconnecting VPN
-
Git provider status:
- Check status.github.com
- GitLab status page
- May be temporary outage
”Git Not Initialized” Error
Symptoms:
- Error: “Git not initialized in workspace”
Solutions:
- Go to Settings → Sync
- Expand Git Configuration
- Click Initialize Git
- Then click Connect Remote
- Try syncing again
Push/Pull Takes Forever
Symptoms:
- Sync stuck on “Pushing…” or “Pulling…”
- No progress for minutes
Solutions:
-
Check file sizes:
- Large files (>50MB) slow down sync
- Remove or use Git LFS
-
Check commit count:
- First sync of large workspace takes time
- Subsequent syncs much faster
-
Check network speed:
- Run speed test
- Slow upload speed affects push
-
Repository size:
- Large repositories (>1GB) sync slowly
- Consider archiving old notes
Conflicts Won’t Resolve
Symptoms:
- Resolved conflicts but status still shows warning
- Can’t commit after resolving
Solutions:
-
Check for remaining markers:
- Search workspace for
<<<<<<< - Ensure all markers removed
- Search workspace for
-
Force resolution:
- Right-click status → Advanced
- Choose Keep Local or Keep Remote
- Confirm operation
-
Manual Git commands (Advanced):
cd /path/to/workspace git status # See conflicted files # Edit files to resolve git add . git commit -m "Resolve conflicts"
“Remote Does Not Match” Error
Symptoms:
- Error: “src refspec does not match any existing object”
Solutions:
-
Verify remote URL:
- Settings → Sync
- Check URL is correct
- Must end with
.git
-
Recreate remote connection:
- Settings → Sync → Git Configuration
- Click Connect Remote again
-
Check branch name:
- Verify branch exists on remote
- Common:
mainvsmaster
Advanced Troubleshooting
View Git Logs
To diagnose complex issues, check Git logs:
macOS/Linux:
cd /path/to/workspace
git log --oneline -10 # Last 10 commits
git status # Current status
git remote -v # Verify remoteWindows:
cd C:\path\to\workspace
git log --oneline -10
git status
git remote -vReset to Remote State
If local repository is corrupted:
Warning: This discards ALL local changes! Backup first.
cd /path/to/workspace
git fetch origin
git reset --hard origin/mainThen in Lokus:
- Right-click status → Check Status
- Should show “Synced”
Reinitialize Sync
If all else fails, reinitialize Git sync:
Backup first! Copy workspace folder before proceeding.
- Backup workspace folder
- Settings → Sync → Git Configuration
- Click Reset Configuration (clears all settings)
- Delete
.gitfolder in workspace - Follow setup instructions again
- Pull changes from remote
FAQ
Does Git Sync replace backups?
No. Git sync is for synchronization, not backups.
Why not a backup?
- Deleting a file syncs the deletion across devices
- Force operations can overwrite data
- Repository corruption affects all devices
Recommended backup strategy:
- Git sync: Real-time synchronization
- Time Machine/Windows Backup: Local backups
- Cloud backup: Separate backup service (Backblaze, etc.)
- Export archives: Periodic exports to ZIP/external drive
Can multiple people sync to the same workspace?
Yes, but with caveats:
Works well for:
- Collaboration on shared notes
- Team knowledge bases
- Project documentation
Challenges:
- Frequent conflicts if editing simultaneously
- Need coordination on who edits what
- All users need access to repository
Better alternatives for collaboration:
- Separate branches per person
- Designated note owners
- Communication about who’s editing
What happens if I delete a note on one device?
The deletion syncs to all devices:
- Delete note on Device A
- Commit & push
- Device B pulls changes
- Note deleted on Device B
Recovery:
- Git preserves history
- Can restore from previous commits
- Use Git commands:
git log,git checkout
Does Git Sync work with large files?
Limited support:
- Text files: Excellent (Markdown, code, etc.)
- Small images (
<1MB): Okay - Large files (>50MB): Very slow
- Videos/Audio: Not recommended
For large files:
- Use Git LFS (Large File Storage)
- Or: Store in cloud (Dropbox, etc.) and link in notes
- Or: Keep in separate non-synced folder
Can I use SSH instead of HTTPS?
Not currently supported.
Lokus Git Sync requires HTTPS URLs with personal access tokens.
Why HTTPS?
- Simpler authentication (tokens vs SSH keys)
- Works across all platforms without setup
- Easier for non-technical users
Workaround:
- Use Git command line with SSH manually
- Then use Lokus for editing only
What’s the difference between Git Sync and cloud sync (Dropbox, etc.)?
| Feature | Git Sync | Cloud Sync (Dropbox, etc.) |
|---|---|---|
| Cost | Free | Paid (usually) |
| Privacy | Full control | Provider has access |
| Conflict Resolution | Intelligent merging | File duplication |
| Version History | Complete Git history | Limited versions |
| Offline Access | Full | Depends on provider |
| Setup Complexity | Medium | Easy |
| Collaboration | Built-in (Git) | Limited |
Best of both worlds:
- Use Git Sync for version control and collaboration
- Store Git repository in cloud folder for extra backup
How do I stop syncing?
To disable Git Sync:
- Settings → Sync
- Expand Git Configuration
- Click Reset Configuration
- Removes remote connection
- Workspace becomes local-only
Your files remain unchanged. You can reconfigure sync later.
To completely remove Git:
- Close Lokus
- Delete
.gitfolder in workspace - Workspace is now a plain folder
Security Considerations
Data Privacy
What’s private:
- Your notes content (encrypted in transit via HTTPS)
- Repository access (private repository)
- Token (stored encrypted locally)
What’s potentially visible:
- Commit messages (visible in Git history)
- File names (visible in Git history)
- Commit timestamps (visible in Git history)
Best practices:
- Use private repositories
- Avoid sensitive data in commit messages
- Use descriptive but not revealing file names
Token Security
Protect your token:
- Never share tokens
- Never commit tokens to code
- Revoke tokens if compromised
- Use minimum required permissions
- Set reasonable expiration dates
Revoke token if:
- Device is lost or stolen
- Token accidentally exposed
- You stop using Lokus
- Suspicious activity detected
To revoke:
- GitHub: Settings → Developer settings → Tokens → Delete
- GitLab: Preferences → Access Tokens → Revoke
- Bitbucket: Settings → App passwords → Delete
Repository Access
Who can access:
- You (repository owner)
- Collaborators you explicitly add
- No one else (if private)
Check access:
- GitHub: Repository → Settings → Collaborators
- GitLab: Project → Members
- Bitbucket: Repository → Settings → User and group access
Remove access:
- Remove collaborators you no longer trust
- Regenerate token if shared accidentally
Network Security
Git HTTPS is encrypted:
- Data encrypted in transit (TLS/SSL)
- Same security as online banking
- Safe on public WiFi (but VPN still recommended)
Additional security:
- Use VPN for extra layer
- Avoid unencrypted public WiFi without VPN
- Keep Lokus updated for security patches
Related Features
- Workspace Management: Organize your workspace
- File Management: Manage files and folders
- Settings: Configure Lokus
- Keyboard Shortcuts: Master shortcuts
Getting Help
Need assistance with Git Sync?
- Troubleshooting Guide: Solve common issues
- Community Forum: Ask questions
- GitHub Issues: Report bugs
- Email Support: support@lokus.app
What’s Next?
- Template System: Automate note creation
- Bases: Structure your data
- Advanced Search: Find anything instantly