e9373ba1e116d6e5bc6f1853f96640ed3c5809be
Git Repository Setup Script for Gitea
This script helps you create a git repository from existing codebase and configure it to synchronize with a Gitea server.
Features
-
Multiple Authentication Methods:
- SSH (passwordless after key setup)
- HTTPS (with token/password)
- Tea CLI (Gitea's official command-line tool)
-
Automatic Setup:
- Git repository initialization
- SSH key generation (if needed)
- Tea CLI installation and configuration
- Remote repository creation
- Connection testing
Usage
-
Make the script executable:
chmod +x setup-git-repo.sh -
Run the script:
./setup-git-repo.sh -
Follow the prompts to provide:
- Your name and email
- Gitea server URL
- Repository name and description
- Authentication method preference
Authentication Methods
1. SSH (Recommended)
- Generates ED25519 SSH key if none exists
- Provides passwordless authentication after initial setup
- Most secure for automated workflows
2. HTTPS
- Uses access tokens or password authentication
- Good for environments where SSH is blocked
- May require credential management
3. Tea CLI
- Installs and configures Gitea's official CLI tool
- Creates repository via Gitea API
- Provides additional repository management features
Requirements
- Git installed
- Internet connection for Gitea access
- Appropriate permissions on Gitea server
Tea CLI Information
The script can automatically install tea CLI, which is Gitea's official command-line tool. Tea provides:
- Repository management
- Issue and pull request handling
- Release management
- And much more
For more information about tea CLI: https://gitea.com/gitea/tea
Example Workflow
./setup-git-repo.sh
# Follow prompts...
git add .
git commit -m "Initial commit"
git push -u origin main
The script handles all the complex setup, allowing you to focus on your code.
Description
Languages
Shell
100%