This commit is contained in:
retoor 2025-12-05 18:16:04 +01:00
parent 8db6f39046
commit f8d650567a

View File

@ -1,244 +0,0 @@
# Snek Git Integration Guide
## Overview
Snek provides full Git repository hosting with HTTP/HTTPS support. You can clone, push, pull, and manage repositories directly through the web interface or using standard Git clients.
## Quick Start
### Creating a Repository
1. Navigate to **Settings** → **Repositories**
2. Click **New Repository**
3. Enter a repository name (e.g., `myproject`)
4. Choose visibility (Public or Private)
5. Click **Create**
### Cloning Your Repository
After creating a repository, you'll see a clone URL on the repositories list page. Use this with your Git client:
```bash
git clone http://username:password@your-snek-server.com/git/YOUR_UID/reponame.git
```
Replace:
- `username` - Your Snek username
- `password` - Your Snek password
- `your-snek-server.com` - Your Snek server domain/IP
- `YOUR_UID` - Your user ID (shown in the clone URL)
- `reponame` - Your repository name
### Example Workflow
```bash
# Clone the repository
git clone http://john:mypass@localhost:8081/git/9c1cd9e5-19ce-4038-8637-d378400a4f33/myproject.git
# Make changes
cd myproject
echo "# My Project" > README.md
git add README.md
git commit -m "Initial commit"
# Push to Snek
git push origin main
```
## Features
### Web Interface
- **Browse Code**: View repository files and directories through the web browser
- **Commit History**: See recent commits with author and date information
- **Branch Management**: View and switch between branches
- **File Viewing**: Read file contents directly in the browser
### Git Client Support
Snek supports standard Git HTTP protocol. Any Git client works:
- Command-line `git`
- GitHub Desktop
- GitKraken
- VS Code Git integration
- IntelliJ IDEA Git plugin
## Repository URLs
Snek provides multiple URL formats:
### Clone URL (for Git clients)
```
http://username:password@server/git/USER_UID/repository.git
```
### Browse URL (web interface)
```
http://server/repository/USERNAME/repository
```
## Authentication
Git operations require HTTP Basic Authentication:
- **Username**: Your Snek username
- **Password**: Your Snek password
To avoid entering credentials every time, configure Git credential helper:
```bash
# Store credentials (Linux/Mac)
git config --global credential.helper store
# After first push/pull, credentials are saved
```
## Permissions
- **Private repositories**: Only you can access
- **Public repositories**: Anyone can read, only you can write
## Troubleshooting
### Authentication Failed
**Problem**: `fatal: Authentication failed`
**Solution**:
- Verify your username and password are correct
- Ensure you're using your Snek credentials, not Git credentials
- Check if Basic Auth is properly formatted in URL
### Repository Not Found
**Problem**: `fatal: repository not found`
**Solution**:
- Verify the repository exists in your Snek account
- Check the UID in the clone URL matches your user ID
- Ensure repository name is spelled correctly
### Push Rejected
**Problem**: `error: failed to push some refs`
**Solution**:
- Pull latest changes first: `git pull origin main`
- Resolve any merge conflicts
- Try push again
### SSL/TLS Errors
**Problem**: Certificate verification failed
**Solution**:
- If using self-signed certificate, disable SSL verification (development only):
```bash
git config --global http.sslVerify false
```
- For production, use proper SSL certificates
## Advanced Usage
### Working with Branches
```bash
# Create a new branch
git checkout -b feature-branch
# Push new branch to Snek
git push origin feature-branch
# Switch branches
git checkout main
```
### Viewing Repository Info
Visit your repository settings page to see:
- Clone URL
- Repository size
- Creation date
- Public/Private status
### Deleting Repositories
1. Go to **Settings** → **Repositories**
2. Find the repository
3. Click **Delete**
4. Confirm deletion
**Warning**: This action cannot be undone. All commits and history will be lost.
## Technical Details
### Repository Storage
Repositories are stored as bare Git repositories in:
```
drive/repositories/USER_UID/repository.git
```
### Supported Git Operations
- Clone
- Pull
- Push
- Fetch
- Branch creation
- Tag creation
- All standard Git commands
### Protocol Support
- HTTP (git-upload-pack, git-receive-pack)
- Smart HTTP protocol
- Compression supported
- Large file support (up to 5GB per request)
## Security Best Practices
1. **Use strong passwords** for your Snek account
2. **Enable 2FA** if available
3. **Use HTTPS** in production (not HTTP)
4. **Keep repositories private** unless intended for public access
5. **Rotate credentials** periodically
6. **Don't commit secrets** (API keys, passwords, etc.)
## API Usage
For programmatic access, use the Git HTTP API:
### Create Repository
```bash
curl -u username:password -X POST \
http://server/git/create/myrepo
```
### Delete Repository
```bash
curl -u username:password -X DELETE \
http://server/git/delete/myrepo
```
### Get Repository Status
```bash
curl -u username:password \
http://server/git/status/myrepo
```
## Support
For issues or questions:
1. Check this guide first
2. Review error messages carefully
3. Check Snek application logs
4. Contact your Snek administrator
## Changelog
### Version 1.0
- Initial Git integration
- HTTP protocol support
- Web-based repository browser
- Basic authentication
- Public/Private repositories