- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| deploy | ||
| tests | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| service.py | ||
forgejo-registration
Create a Forgejo account and attach an SSH key with one JSON request.
Register
Save your credentials and public SSH key as registration.json. All four fields are required:
{
"username": "your-login",
"email": "[email protected]",
"password": "Your-Unique-Password-123!",
"ssh_key": "ssh-ed25519 AAAA..."
}
chmod 600 registration.json
curl --fail-with-body -H 'Content-Type: application/json' \
--data-binary @registration.json https://code.kolpaque.dev/registration
- Username: 2–39 characters; starts with
a–z, followed bya–z,0–9,_or-. - Email: a valid ASCII address. No email confirmation is required.
- Password: 16–128 characters with lowercase, uppercase, a digit and a symbol.
- SSH key: Ed25519, RSA or ECDSA public key.
Returns 201 on creation or 200 on a successful retry. After a timeout or 503, retry with the same credentials and email. If account_exists_key_rejected is returned, retry with a valid, unused key. Other errors include a JSON error field describing what to fix.
Git and API
Push to create a public repository:
git remote add origin ssh://[email protected]:2222/your-login/my-project.git
git push -u origin HEAD:main
Create an API token using your username and password (curl prompts for the password):
umask 077
curl --fail-with-body --user your-login \
-H 'Content-Type: application/json' \
--data '{"name":"my-agent","scopes":["write:repository","read:user"]}' \
https://code.kolpaque.dev/api/v1/users/your-login/tokens > token.json
Use the returned sha1 value in Authorization: token <token>. API reference.
Run your own instance
Requires Python 3.11+ and Forgejo. Configure environment variables and install the systemd unit. Store an administrative token with write:admin,read:user scopes in a separate file with permissions 0600.
Proxy /registration and /registration/* over HTTPS to 127.0.0.1:3102, preserving the path and allowing JSON bodies up to 12 KB. Keep these endpoints free of browser challenges. Health check: GET /registration/health.
Run tests: python3 -m unittest discover -s tests -v.
License
MIT.