fix: Gitea push 404 — add branch:main payload, handle 409 empty repo, clearer settings
- lib/git.ts: add branch:"main" to Gitea POST payload (required when repo has no branch yet or is freshly initialized); treat 409 on GET same as 404 (empty repo has no tree, Gitea returns 409 Conflict — proceed to create first file) - lib/git.ts: improve 404 error hint with actionable checklist (URL format, owner/repo names, token scope, repo existence) - settings.tsx: add Gitea info card clarifying URL format (no /api/v1), token format (raw value only, no "Bearer" prefix), repo initialization requirement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+21
-2
@@ -402,6 +402,25 @@ export default function SettingsScreen() {
|
||||
|
||||
{gitProvider === "gitea" && (
|
||||
<>
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: Colors.surface,
|
||||
borderRadius: 8,
|
||||
padding: 12,
|
||||
marginBottom: 14,
|
||||
borderLeftWidth: 3,
|
||||
borderLeftColor: Colors.text2,
|
||||
}}
|
||||
>
|
||||
<Text style={{ color: Colors.text2, fontSize: 12, lineHeight: 18 }}>
|
||||
<Text style={{ fontWeight: "700" }}>Instance URL</Text>
|
||||
{" — base URL only, no trailing slash, no /api/v1.\n"}
|
||||
<Text style={{ fontWeight: "700" }}>Token</Text>
|
||||
{" — Gitea PAT with write:repository scope. Paste the token value only (no \"Bearer\" prefix).\n"}
|
||||
<Text style={{ fontWeight: "700" }}>Repository</Text>
|
||||
{" — must have at least one commit (initialize it with a README if empty)."}
|
||||
</Text>
|
||||
</View>
|
||||
<Field
|
||||
label="Instance URL"
|
||||
value={giteaUrl}
|
||||
@@ -410,10 +429,10 @@ export default function SettingsScreen() {
|
||||
url
|
||||
/>
|
||||
<Field
|
||||
label="Token"
|
||||
label="Token (PAT, write:repository)"
|
||||
value={giteaToken}
|
||||
onChange={setGiteaToken}
|
||||
placeholder="Bearer token"
|
||||
placeholder="paste token value here"
|
||||
secure
|
||||
/>
|
||||
<Field
|
||||
|
||||
Reference in New Issue
Block a user