From 6924df88bdd5b2fd5cbfcf51a5d1a15bda8b57c0 Mon Sep 17 00:00:00 2001 From: Lutz Finsterle Date: Thu, 22 Jan 2026 21:04:29 +0100 Subject: [PATCH] v0.1 --- README.md | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..efd2ebd --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +# Gitea Remote Management + +Remote management of Gitea repositories via CLI tools and API. + +## Overview + +This guide covers how to remotely create bare repositories in a local Gitea instance using CLI tools - useful for bulk importing existing projects. + +## Options + +### 1. Official Gitea CLI: `tea` + +Gitea has an official CLI tool called `tea` that can manage repositories remotely. + +#### Installation + +**Debian/Ubuntu:** + +```bash +# Download the latest release (check https://gitea.com/gitea/tea/releases for current version) +wget https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-linux-amd64 +chmod +x tea-0.9.2-linux-amd64 +sudo mv tea-0.9.2-linux-amd64 /usr/local/bin/tea +``` + +Alternatively, build from source: + +```bash +# Requires Go 1.18+ +go install code.gitea.io/tea@latest +``` + +**macOS:** + +```bash +# Using Homebrew +brew tap gitea/tap https://gitea.com/gitea/homebrew-gitea +brew install tea +``` + +Or download manually: + +```bash +# For Apple Silicon (M1/M2/M3) +curl -L https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-darwin-arm64 -o tea +# For Intel Macs +curl -L https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-darwin-amd64 -o tea + +chmod +x tea +sudo mv tea /usr/local/bin/ +``` + +#### Usage + +```bash +# Login to your instance +tea login add --name mygitea --url https://gitea.example.com --token YOUR_API_TOKEN + +# Create a new repository +tea repo create --name my-new-repo --private +``` + +### 2. Gitea REST API + +You can use the API directly with `curl` or any HTTP client: + +```bash +curl -X POST "https://gitea.example.com/api/v1/user/repos" \ + -H "Authorization: token YOUR_API_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"name": "my-new-repo", "private": true}' +``` + +### 3. Bulk Import Strategy + +For adding many existing projects, you can script the process: + +```bash +for dir in /path/to/projects/*/; do + repo_name=$(basename "$dir") + # Create remote repo via API + curl -X POST "https://gitea.example.com/api/v1/user/repos" \ + -H "Authorization: token $GITEA_TOKEN" \ + -d "{\"name\": \"$repo_name\"}" + # Add remote and push + cd "$dir" + git remote add gitea "https://gitea.example.com/user/$repo_name.git" + git push --mirror gitea +done +``` + +## Getting an API Token + +In Gitea: **Settings → Applications → Generate New Token** + +## Resources + +- [Gitea API Documentation](https://docs.gitea.com/development/api-usage) +- [tea CLI Repository](https://gitea.com/gitea/tea)