fix: Forgejo API tokens rejected for git HTTP push — agents must use password auth #361
Labels
No labels
action
backlog
blocked
bug-report
in-progress
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#361
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Forgejo 11.x rejects API tokens (created via POST /api/v1/users/{user}/tokens with scopes ["all"]) for git HTTP push operations:
The same token works for all Forgejo REST API calls. Git clone also works with the token. Only git push is rejected.
Password-based HTTP auth works:
This forces all agents to use password auth for git operations, which is less secure and requires storing plaintext passwords.
Root cause
Forgejo may require specific token scopes for git write operations that the "all" scope doesn't cover, or there's a bug in Forgejo 11's git HTTP auth handler for API tokens.
Relevant: https://codeberg.org/forgejo/forgejo/issues/2809
Current workaround
Agent git remotes use password auth: http://dev-bot:@forgejo:3000/...
Proposed fix
Investigate Forgejo 11 token scopes for git push. The fix is either:
The git remote setup happens in:
Affected files
Acceptance criteria