Let the git remote be set from Settings
Attaching a workspace to an existing repository meant leaving for a terminal: gitsync could init, commit and push, and could tell whether an 'origin' existed, but had no way to create one, and nothing in the settings held a remote URL. Sync just logged "no 'origin' remote configured" and committed locally. Settings > Git remote... now shows the workspace repository's origin and lets it be set, repointed or cleared. The URL is read from and written to the repository, never to config.json, because a remote belongs to the checkout — so each workspace shows its own, and the box is refreshed whenever the repository in play changes. This is separate from the Gitea publishing in New project, which is a cookiecutter post-gen hook and only ever applies to generated projects. Also factors out first_output_line, which repo_root and the new origin_url were both open-coding, and origin_args, so the add-vs-set-url decision can be tested without a repository on disk. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GBWj9TphFMCoh7VHaSRnvQ
This commit is contained in:
@@ -63,14 +63,21 @@ Terminal=false
|
||||
or click **📂** to pick a folder in a native file browser — and press **Open**.
|
||||
The directory is created if it does not exist.
|
||||
2. Press **Init git** once to make the workspace a git repository. To sync with
|
||||
another machine, add a remote yourself:
|
||||
another machine, point it at a remote through **Settings ▸ Git remote…**:
|
||||
paste the repository's clone URL into the **origin** box and press **Set
|
||||
origin**. The repository has to exist on the server already — this attaches
|
||||
to it, it does not create it. Clearing the box and pressing Set detaches
|
||||
again. The equivalent from a terminal, if you prefer:
|
||||
```sh
|
||||
cd ~/Manuscript
|
||||
git remote add origin <url>
|
||||
git push -u origin main
|
||||
```
|
||||
Either way the URL lives in the repository's own `.git/config`, not in this
|
||||
app's settings, so every workspace keeps its own.
|
||||
|
||||
After that, the **⟳ Sync (git)** button commits all changes, `pull --rebase`s,
|
||||
and pushes.
|
||||
and pushes (setting the upstream on the first push). Until origin is set it
|
||||
commits locally and says so in the log.
|
||||
|
||||
If you open a folder that is *not* itself a repository but sits inside one
|
||||
(a parent directory is a git work tree), the app asks whether to **use the
|
||||
@@ -509,6 +516,14 @@ push command alone and is not written into the project's `.git/config`.
|
||||
The token is stored in `config.json` in plain text, the same as the Mistral API
|
||||
key.
|
||||
|
||||
Note that this is the *only* place the app creates a remote repository, and it
|
||||
runs entirely inside the template's hook — the app itself never talks to Gitea.
|
||||
So it applies to projects made through **New project** and nothing else, and it
|
||||
does nothing if **Run the template's hooks** is off, if any of the three Gitea
|
||||
settings is blank, or if the template has no such hook. For any workspace that
|
||||
did not come from the template, attach the remote with **Settings ▸ Git
|
||||
remote…** instead.
|
||||
|
||||
## New files from a template
|
||||
|
||||
The file list has two create buttons:
|
||||
|
||||
Reference in New Issue
Block a user