- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .gitignore | ||
| forgejo-create.sh | ||
| install.sh | ||
| README.md | ||
Forgejo Repository Creator (forgejo-create)
A lightweight, zero-dependency (POSIX bash + curl + git) CLI tool that turns any local folder into a new Forgejo Git repository and pushes all code in a single command.
⚡ One-Command Installation
You can install forgejo-create directly into ~/.local/bin (or /usr/local/bin if root):
From your Forgejo repository:
curl -fsSL https://aifg.be2x.com/badmark/forgejo-creator/raw/branch/main/forgejo-create.sh -o ~/.local/bin/forgejo-create && chmod +x ~/.local/bin/forgejo-create
(Or if you host install.sh: curl -fsSL https://aifg.be2x.com/badmark/forgejo-creator/raw/branch/main/install.sh | bash)
From cloned repo:
./install.sh
Note
: Ensure
~/.local/binis in your$PATH. If not, addexport PATH="$HOME/.local/bin:$PATH"to your~/.bashrcor~/.zshrc.
🚀 How It Works
1. First Run (Credential Setup)
When you run forgejo-create for the first time, an interactive setup wizard will prompt you for:
- Forgejo Instance URL: (e.g.,
https://forgejo.example.comorhttps://codeberg.org) - Forgejo Personal Access Token: Create one in Forgejo under Settings -> Applications -> Generate New Token with
repository(Read & Write) permissions. - Push Protocol:
https(token-authenticated) orssh(if SSH keys are already configured). - Default Visibility:
private(default) orpublic. - Default Branch:
main(default).
Your configuration is tested and saved securely to ~/.config/forgejo-create/config with strict 0600 permissions.
2. Subsequent Runs (Creating Repositories)
Navigate to any directory on your machine containing code and run:
forgejo-create
The script will:
- Prompt for repository name (defaults to current folder name).
- Prompt for optional description and visibility.
- Authenticate with Forgejo and create the remote repository via API.
- Initialize the local Git repository (if not already initialized).
- Stage all files (
git add -A) and commit them. - Configure the remote
originand push all code directly to Forgejo. - Print the web URL to your new repository!
🛠️ CLI Options
Usage:
forgejo-create [OPTIONS]
Options:
-n, --name <name> Name of the remote repository (default: current directory name)
-d, --description <text> Description for the repository
--public Create as a public repository
--private Create as a private repository
--org <org_name> Create repository under an organization instead of user account
-b, --branch <branch> Initial branch name (default: main)
--reconfigure Run the configuration setup wizard again
-v, --version Show version information
-h, --help Show this help message
Examples
# Interactive mode (prompts for name and description)
forgejo-create
# Non-interactive quick creation with custom name
forgejo-create -n my-cool-project --public -d "My new project"
# Create under an organization
forgejo-create --org my-org -n microservice-api
# Update stored credentials/URL
forgejo-create --reconfigure
🔒 Security & Credential Storage
Credentials are stored in:
~/.config/forgejo-create/config
This file is generated with chmod 600 (read/write access restricted solely to the owner).