You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4.4 KiB
4.4 KiB
Editing a Repo
This page covers all aspects of editing repositories: branch management, file management, auto-provisioning, file-editing permissions, and event-creation permissions.
Auto-Provisioning
When you create a repository announcement, GitRepublic automatically:
- Polls Nostr relays for new announcements
- Creates a bare git repository at
/repos/{npub}/{repo-name}.git - Fetches self-transfer event for ownership verification
- Creates initial commit with README.md (if provided)
- Saves announcement and transfer events to
nostr/repo-events.jsonl - Syncs from other remotes if clone URLs are configured
The repository is ready to use immediately after announcement.
Branch Management
Creating Branches
Via Web Interface
- Navigate to your repository
- Click Create Branch button
- Enter branch name
- Select source branch
- Click Create
Via Git
git checkout -b feature/new-feature
git push origin feature/new-feature
Viewing Branches
- Web Interface: View all branches on the repository page
- API:
GET /api/repos/{npub}/{repo}/branches - CLI:
gitrep repos branches <npub> <repo>
Default Branch
The default branch (usually main) can be changed via:
- Web Interface: Repository settings
- API:
POST /api/repos/{npub}/{repo}/default-branch
File Management
Reading Files
Via Web Interface
- Navigate to repository
- Click File tab
- Browse directory structure
- Click files to view content
Via API
GET /api/repos/{npub}/{repo}/file?path={file-path}&branch={branch}
Via CLI
gitrep file get <npub> <repo> <path> [branch]
Creating/Updating Files
Via Web Interface
- Navigate to repository
- Click File tab
- Click Edit button on a file (or create new)
- Use the code editor to make changes
- Enter commit message
- Select branch
- Click Save
Via API
POST /api/repos/{npub}/{repo}/file
{
"path": "file.txt",
"content": "File content",
"commitMessage": "Add file",
"branch": "main",
"action": "write"
}
Via CLI
gitrep file put <npub> <repo> <path> [file] [message] [branch]
Deleting Files
Via Web Interface
- Navigate to file
- Click Delete button
- Enter commit message
- Click Delete
Via API
POST /api/repos/{npub}/{repo}/file
{
"path": "file.txt",
"commitMessage": "Remove file",
"branch": "main",
"action": "delete"
}
Via CLI
gitrep file delete <npub> <repo> <path> [message] [branch]
Permissions
File Editing Permissions
- Repository Owner: Can edit all files
- Maintainers: Can edit all files
- Other Users: Cannot edit files (read-only)
Event Creation Permissions
Different events have different permission requirements:
- Pull Requests: Anyone can create
- Issues: Anyone can create
- Patches: Anyone can create
- Comments: Anyone can comment
- Status Updates: Only owners/maintainers can update PR/issue status
- Repository Settings: Only owners/maintainers can update
Branch Protection
Repository owners can protect branches:
- Require Pull Requests: Direct pushes blocked, must use PRs
- Require Reviews: PRs need approval before merging
- Require Status Checks: Custom checks must pass
Configure via:
- Web Interface: Repository settings → Branch Protection
- API:
POST /api/repos/{npub}/{repo}/branch-protection
Code Editor
The web interface includes a full-featured code editor with:
- Syntax Highlighting: Supports many languages
- Line Numbers: Easy navigation
- Word Wrap: Toggle for long lines
- Search/Replace: Find and replace functionality
- File Browser: Navigate directory structure
Commit Signing
Commits can be automatically signed using Nostr keys:
- CLI: Automatic signing via commit hook (if configured)
- Web Interface: Commits are signed by the server using your NIP-07 key
Commit signatures are stored as Nostr events (kind 1640) and can be verified.
File Size Limits
- Maximum file size: 500 MB per file
- Maximum repository size: 2 GB total
These limits prevent abuse and ensure reasonable resource usage.
Next Steps
- Managing a repo - Complete repository management guide
- REST API and CLI - Programmatic access