VS Code Settings Sync with GitHub
Synchronize your VS Code settings, keybindings, snippets, and shell configuration files using GitHub. This extension provides a seamless way to keep your development environment consistent across multiple machines.
Features
- 🔄 Automatic Synchronization: Keep your settings in sync automatically
- 🐚 Shell Config Support: Sync your shell configuration files (.bashrc, .zshrc, etc.)
- 🎨 VS Code Settings: Sync settings.json, keybindings.json, and snippets
- 🧩 Extension Sync: Keep your VS Code extensions synchronized
- 🔒 Git-based: Uses Git for version control and conflict resolution
- ⚡ Smart Sync: Debounced file watching to prevent excessive syncs
- 🛠️ Configurable: Extensive configuration options for customization
Installation
- Open VS Code
- Press
Ctrl+P
(Windows/Linux) or Cmd+P
(macOS)
- Type
ext install sync-settings-with-github
- Press Enter
Setup
- Create a GitHub repository for your settings
- Open VS Code settings (
Ctrl+,
or Cmd+,
)
- Search for "Settings Sync"
- Set your GitHub repository URL in
settingsSync.git.repositoryUrl
- Run the "Initialize Settings Sync" command from the command palette (
Ctrl+Shift+P
or Cmd+Shift+P
)
Commands
- Initialize Settings Sync: Set up initial synchronization
- Force Push Settings: Override remote settings with local ones
- Force Pull Settings: Override local settings with remote ones
- Sync Settings: Perform a two-way sync
- Toggle Settings Sync: Enable/disable automatic sync
- Open Settings Repository: Open the local Git repository
- Reinitialize Settings Repository: Reset and reinitialize the repository
Configuration
Git Settings
```json
{
"settingsSync.git.repositoryUrl": "",
"settingsSync.git.branch": "main",
"settingsSync.git.pullBeforePush": true,
"settingsSync.git.pullBeforeForcePush": false
}
```
Sync Settings
```json
{
"settingsSync.syncInterval": 300,
"settingsSync.autoSync": true,
"settingsSync.pullOnLaunch": true,
"settingsSync.debounceDelay": 5
}
```
File Patterns
```json
{
"settingsSync.files": {
"patterns": [
"settings.json",
"keybindings.json",
"snippets/**/*.code-snippets",
"globalStorage/storage.json"
],
"excludePatterns": [],
"externalFiles": [
{
"source": "~/.bashrc",
"target": "shell/bashrc"
},
{
"source": "~/.zshrc",
"target": "shell/zshrc"
}
]
}
}
```
Extension Sync
```json
{
"settingsSync.extensions.sync": true,
"settingsSync.extensions.autoRemove": false
}
```
Usage Examples
Basic Setup
- Create a GitHub repository for your settings
- Configure the repository URL:
{
"settingsSync.git.repositoryUrl": "https://github.com/username/vscode-settings.git"
}
- Run "Initialize Settings Sync"
- Your settings will start syncing automatically
Adding Shell Config Files
Add shell configuration files to sync:
{
"settingsSync.files.externalFiles": [
{
"source": "~/.bashrc",
"target": "shell/bashrc"
},
{
"source": "~/.zshrc",
"target": "shell/zshrc"
},
{
"source": "~/.config/fish/config.fish",
"target": "shell/fish/config.fish"
}
]
}
Custom File Patterns
Add custom files or folders to sync:
{
"settingsSync.files.patterns": [
"settings.json",
"keybindings.json",
"snippets/**/*.code-snippets",
"globalStorage/storage.json",
"custom-folder/**/*"
]
}
Troubleshooting
Push Conflicts
If you encounter push conflicts:
- Use "Open Settings Repository" to view the local repository
- Resolve conflicts manually
- Use "Force Push" or "Force Pull" as needed
Sync Issues
If synchronization isn't working:
- Check your Git repository URL
- Ensure you have proper Git credentials
- Check the VS Code output panel for detailed logs
- Try reinitializing the repository
Missing Files
If files aren't syncing:
- Verify file patterns in settings
- Check file permissions
- Ensure external files exist at specified paths
- Check the VS Code output panel for file-related logs
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Publishing
This extension is automatically published to the VS Code Marketplace when a new tag is pushed to the repository. To publish a new version:
- Update the version in
package.json
- Create and push a new tag:
git tag v1.0.0 # Use appropriate version
git push origin v1.0.0
- The GitHub Action will automatically:
- Build and test the extension
- Create a VSIX package
- Publish to the VS Code Marketplace
- Create a GitHub release
Required Secrets
The following secrets need to be set in your GitHub repository:
VSCE_PAT
: Personal Access Token for publishing to the VS Code Marketplace
- Generate from Azure DevOps
- Needs "Marketplace > Manage" permission
License
MIT License - see LICENSE file for details