3.7 KiB
3.7 KiB
Setting Up Git Access with Gitea and Obsidian
Part 1: Authorizing Git Client Access
Prerequisites
- Gitea instance accessible through your domain (bee8333.ddns.net) via HTTPS
- Administrative privileges for initial setup
Repository Setup
- For new repositories using HTTPS:
git clone https://bee8333.ddns.net:3000/username/repository.git
- For new repositories using SSH:
git clone ssh://git@bee8333.ddns.net:222/username/repository.git
- For existing repositories (HTTPS):
git remote set-url origin https://bee8333.ddns.net:3000/username/repository.git
- For existing repositories (SSH):
git remote set-url origin ssh://git@bee8333.ddns.net:222/username/repository.git
Authentication
When using HTTPS:
- You'll be prompted for your Gitea username and password
- For better security, create a Personal Access Token in Gitea:
- Go to Settings → Applications → Generate New Token
- Give it a description
- Copy the token immediately (it won't be shown again)
- Use this token as your password when Git asks for credentials
When using SSH:
- Generate an SSH key pair if you haven't already:
ssh-keygen -t ed25519 -C "your_email@example.com" - Add your public key to Gitea:
- Go to Settings → SSH / GPG Keys
- Click "Add Key"
- Paste your public key (from ~/.ssh/id_ed25519.pub)
- SSH will use your key automatically for authentication
Important Note
When using non-standard HTTPS ports (like 3000):
- Use an elevated (Administrator) PowerShell/Command Prompt for Git operations
- Regular terminals in VS Code/Cursor may not have sufficient privileges
- If Git operations fail, try running your terminal as Administrator
Part 2: Obsidian-Git Integration
Plugin Installation
- Open Obsidian Settings → Community plugins
- Search for "Obsidian Git"
- Install and enable the plugin
Plugin Configuration
- Go to Settings → Community plugins → Obsidian Git
- Recommended settings:
- ❌ Auto pull interval (disable when using Syncthing)
- ✅ Show status bar
- ✅ Source Control View
- ✅ Show changes files count in status bar
- Configure default commit message
Essential Commands
Access these via Command Palette (Ctrl/Cmd + P):
Open source control view- View changes and branch infoList changed files- See modificationsView diff- Check file changesStage/Unstage current file- Prepare for commitCommit staged- Save staged changesCreate/Switch branch- Branch management
Recommended Workflow
- Make changes in Obsidian
- Check Source Control View
- Stage desired files
- Commit with meaningful message
- Push to Gitea
Status Bar Features
- Current branch name
- Number of changed files
- Sync status indicators
Important Configuration
Gitignore Setup
Add these patterns to .gitignore:
.trash/
.stversions/
.obsidian/workspace.json
.obsidian/workspace-mobile.json
Security Best Practices
- Keep SSH private keys secure
- Use strong SSH key passphrases
- Regularly review and clean up SSH keys in Gitea
- Never share private keys
Syncthing Compatibility
- Wait for Syncthing sync before Git operations
- Commit/push before closing Obsidian
- Ensure
.stversionsis in.gitignore
Performance Tips
- Stage files individually
- Use branches for major changes
- Commit regularly, push selectively
- Monitor Source Control View
Collaboration Guidelines
- Pull before making changes
- Use branches for significant changes
- Check diff view for conflicts
- Let Syncthing sync complete before Git operations