125 lines
3.7 KiB
Markdown
125 lines
3.7 KiB
Markdown
# 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:
|
|
```bash
|
|
git clone https://bee8333.ddns.net:3000/username/repository.git
|
|
```
|
|
|
|
- For new repositories using SSH:
|
|
```bash
|
|
git clone ssh://git@bee8333.ddns.net:222/username/repository.git
|
|
```
|
|
|
|
- For existing repositories (HTTPS):
|
|
```bash
|
|
git remote set-url origin https://bee8333.ddns.net:3000/username/repository.git
|
|
```
|
|
|
|
- For existing repositories (SSH):
|
|
```bash
|
|
git remote set-url origin ssh://git@bee8333.ddns.net:222/username/repository.git
|
|
```
|
|
|
|
### Authentication
|
|
When using HTTPS:
|
|
1. You'll be prompted for your Gitea username and password
|
|
2. 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:
|
|
1. Generate an SSH key pair if you haven't already:
|
|
```bash
|
|
ssh-keygen -t ed25519 -C "your_email@example.com"
|
|
```
|
|
2. Add your public key to Gitea:
|
|
- Go to Settings → SSH / GPG Keys
|
|
- Click "Add Key"
|
|
- Paste your public key (from ~/.ssh/id_ed25519.pub)
|
|
3. SSH will use your key automatically for authentication
|
|
|
|
### Important Note
|
|
When using non-standard HTTPS ports (like 3000):
|
|
1. Use an elevated (Administrator) PowerShell/Command Prompt for Git operations
|
|
2. Regular terminals in VS Code/Cursor may not have sufficient privileges
|
|
3. If Git operations fail, try running your terminal as Administrator
|
|
|
|
## Part 2: Obsidian-Git Integration
|
|
|
|
### Plugin Installation
|
|
1. Open Obsidian Settings → Community plugins
|
|
2. Search for "Obsidian Git"
|
|
3. Install and enable the plugin
|
|
|
|
### Plugin Configuration
|
|
1. Go to Settings → Community plugins → Obsidian Git
|
|
2. 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 info
|
|
- `List changed files` - See modifications
|
|
- `View diff` - Check file changes
|
|
- `Stage/Unstage current file` - Prepare for commit
|
|
- `Commit staged` - Save staged changes
|
|
- `Create/Switch branch` - Branch management
|
|
|
|
### Recommended Workflow
|
|
1. Make changes in Obsidian
|
|
2. Check Source Control View
|
|
3. Stage desired files
|
|
4. Commit with meaningful message
|
|
5. 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 `.stversions` is 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 |